diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-11-26 23:24:43 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-11-26 23:24:43 -0500 |
| commit | b3ff28189ce8f28abf077dcf343d0d95bf5645c3 (patch) | |
| tree | 8154baa2baef99e28180464138b33b481d983128 /src | |
| parent | a52ede6494d44865fcf05591eaf5715d8bd1dc4a (diff) | |
| download | zig-b3ff28189ce8f28abf077dcf343d0d95bf5645c3.tar.gz zig-b3ff28189ce8f28abf077dcf343d0d95bf5645c3.zip | |
IR: fix crash when duplicate label error
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index b453757367..569de611a8 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -2640,15 +2640,16 @@ IrInstruction *ir_gen(CodeGen *codegen, AstNode *node, BlockContext *scope, IrEx IrInstruction *result = ir_gen_node_extra(irb, node, scope, LValPurposeNone); assert(result); + if (irb->exec->invalid) + return codegen->invalid_instruction; IrInstruction *return_instruction = ir_build_return(irb, result->source_node, result); assert(return_instruction); - if (result == codegen->invalid_instruction) - return codegen->invalid_instruction; - - if (!ir_goto_pass2(irb)) + if (!ir_goto_pass2(irb)) { + irb->exec->invalid = true; return codegen->invalid_instruction; + } return return_instruction; } |
