diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-11-21 13:53:08 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-11-21 13:53:08 -0500 |
| commit | e80e8a80993734f22e9e9c1b8ba078b0b9b946c3 (patch) | |
| tree | e9478d4436b275a7eeed841467a50b9054ab8340 /src/ir.cpp | |
| parent | 67d565136abd904b67792ae61f195a4054463b00 (diff) | |
| download | zig-e80e8a80993734f22e9e9c1b8ba078b0b9b946c3.tar.gz zig-e80e8a80993734f22e9e9c1b8ba078b0b9b946c3.zip | |
IR: fix detection of invalid codegen
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 3907711851..7614544136 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -2058,7 +2058,7 @@ static IrInstruction *ir_gen_if_var_expr(IrBuilder *irb, AstNode *node) { return ir_build_phi(irb, node, 2, incoming_blocks, incoming_values); } -static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, BlockContext *block_context, +static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, BlockContext *block_context, LValPurpose lval) { assert(block_context); @@ -2140,6 +2140,14 @@ static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, BlockCont zig_unreachable(); } +static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, BlockContext *block_context, + LValPurpose lval) +{ + IrInstruction *result = ir_gen_node_raw(irb, node, block_context, lval); + irb->exec->invalid = irb->exec->invalid || (result == irb->codegen->invalid_instruction); + return result; +} + static IrInstruction *ir_gen_node(IrBuilder *irb, AstNode *node, BlockContext *scope) { return ir_gen_node_extra(irb, node, scope, LValPurposeNone); } @@ -4881,6 +4889,8 @@ static TypeTableEntry *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *ins TypeTableEntry *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_exec, TypeTableEntry *expected_type, AstNode *expected_type_source_node) { + assert(!old_exec->invalid); + IrAnalyze ir_analyze_data = {}; IrAnalyze *ira = &ir_analyze_data; ira->codegen = codegen; |
