aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-08-19 17:35:19 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-08-19 17:35:19 -0400
commit6bc520ab957e25f9ae6d0f4d8a8ad4b96e145ac3 (patch)
tree81cdb2ae9662ac51d905eea0ccd40948ebc99c2a /src/ir.cpp
parent24deb1a7fe955202335ed7540fa20a43ae6eca36 (diff)
downloadzig-6bc520ab957e25f9ae6d0f4d8a8ad4b96e145ac3.tar.gz
zig-6bc520ab957e25f9ae6d0f4d8a8ad4b96e145ac3.zip
solve it a slightly different way
the error handling of result locations is a bit awkward but it should basically be the same everywhere
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index a018477e0d..e98f028e31 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -24561,10 +24561,14 @@ static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInst
IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base,
&instruction->result_loc_bit_cast->base, operand->value.type, operand, false, false, true);
- if (result_loc != nullptr && !(type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)))
+ if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)))
return result_loc;
- return instruction->result_loc_bit_cast->parent->gen_instruction;
+ if (instruction->result_loc_bit_cast->parent->gen_instruction != nullptr) {
+ return instruction->result_loc_bit_cast->parent->gen_instruction;
+ }
+
+ return result_loc;
}
static IrInstruction *ir_analyze_instruction_union_init_named_field(IrAnalyze *ira,