authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-18 04:02:36-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-18 04:02:36-04:00
log6f0f8a92ec7cf7eac8c05469a46398f47885614e
tree6fa69eb154f595b8ef4d5424647df9eb050513a2
parent9021bb79695d378a864945f1d398083872ee6530

bail out of analysis on first error during comptime eval

prevents an error during comptime eval from printing a large number of compile errors

1 files changed, 9 insertions(+), 2 deletions(-)

src/ir.cpp+9-2
...@@ -5849,7 +5849,7 @@ static IrInstruction *ir_exec_const_result(CodeGen *codegen, IrExecutable *exec)...@@ -5849,7 +5849,7 @@ static IrInstruction *ir_exec_const_result(CodeGen *codegen, IrExecutable *exec)
5849 return codegen->invalid_instruction;5849 return codegen->invalid_instruction;
5850 }5850 }
5851 }5851 }
5852 zig_unreachable();5852 return codegen->invalid_instruction;
5853}5853}
58545854
5855static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *source_instruction) {5855static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *source_instruction) {
...@@ -7741,7 +7741,11 @@ static int ir_eval_bignum(ConstExprValue *op1_val, ConstExprValue *op2_val,...@@ -7741,7 +7741,11 @@ static int ir_eval_bignum(ConstExprValue *op1_val, ConstExprValue *op2_val,
77417741
7742 bool overflow = bignum_fn(&out_val->data.x_bignum, &op1_val->data.x_bignum, &op2_val->data.x_bignum);7742 bool overflow = bignum_fn(&out_val->data.x_bignum, &op1_val->data.x_bignum, &op2_val->data.x_bignum);
7743 if (overflow) {7743 if (overflow) {
7744 return ErrorOverflow;7744 if (wrapping_op) {
7745 zig_panic("TODO compiler bug, implement compile-time wrapping arithmetic for >= 64 bit ints");
7746 } else {
7747 return ErrorOverflow;
7748 }
7745 }7749 }
77467750
7747 if (type->id == TypeTableEntryIdInt && !bignum_fits_in_bits(&out_val->data.x_bignum,7751 if (type->id == TypeTableEntryIdInt && !bignum_fits_in_bits(&out_val->data.x_bignum,
...@@ -12985,6 +12989,9 @@ TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutabl...@@ -12985,6 +12989,9 @@ TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutabl
12985 }12989 }
1298612990
12987 TypeTableEntry *return_type = ir_analyze_instruction(ira, old_instruction);12991 TypeTableEntry *return_type = ir_analyze_instruction(ira, old_instruction);
12992 if (type_is_invalid(return_type) && ir_should_inline(new_exec, old_instruction->scope)) {
12993 break;
12994 }
1298812995
12989 // unreachable instructions do their own control flow.12996 // unreachable instructions do their own control flow.
12990 if (return_type->id == TypeTableEntryIdUnreachable)12997 if (return_type->id == TypeTableEntryIdUnreachable)