aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-12-14 01:07:23 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-12-14 01:07:23 -0500
commitc9e01412a451419491786bf3db1713875928092c (patch)
treeafb3832a64f5b8e942c24b076cc64dd39c5af406 /src/ir.cpp
parentf55fdc00fcde3cd17ed0ddb94c0997c882dbe6b9 (diff)
downloadzig-c9e01412a451419491786bf3db1713875928092c.tar.gz
zig-c9e01412a451419491786bf3db1713875928092c.zip
fix compiler crash in a nullable if after an if in...
...a switch prong of a switch with 2 prongs in an else closes #656
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 62b9545348..ce7d8dcedd 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -1191,6 +1191,8 @@ static IrInstruction *ir_build_var_decl(IrBuilder *irb, Scope *scope, AstNode *s
if (align_value) ir_ref_instruction(align_value, irb->current_basic_block);
ir_ref_instruction(init_value, irb->current_basic_block);
+ var->decl_instruction = &decl_var_instruction->base;
+
return &decl_var_instruction->base;
}
@@ -5108,9 +5110,7 @@ static IrInstruction *ir_gen_var_decl(IrBuilder *irb, Scope *scope, AstNode *nod
if (init_value == irb->codegen->invalid_instruction)
return init_value;
- IrInstruction *result = ir_build_var_decl(irb, scope, node, var, type_instruction, align_value, init_value);
- var->decl_instruction = result;
- return result;
+ return ir_build_var_decl(irb, scope, node, var, type_instruction, align_value, init_value);
}
static IrInstruction *ir_gen_while_expr(IrBuilder *irb, Scope *scope, AstNode *node) {