From 515092210fe9d9f55c146bdea78289273b97bc0b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 11 Jun 2019 13:48:53 -0400 Subject: [PATCH] fix not checking return value of resolving result --- BRANCH_TODO | 2 ++ src/ir.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/BRANCH_TODO b/BRANCH_TODO index 854b2c0ee..e53144102 100644 --- a/BRANCH_TODO +++ b/BRANCH_TODO @@ -1,6 +1,8 @@ Scratch pad for stuff to do before merging master ================================================= +get an empty file compiling successfully (with no panic fn override) + uncomment all the behavior tests look at all the ir_gen_node ir_gen_node_extra calls and make sure result locations are properly propagated diff --git a/src/ir.cpp b/src/ir.cpp index 0b9956253..c57153d68 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -14946,6 +14946,8 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn return ira->codegen->invalid_instruction; IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, implicit_elem_type, nullptr); + if (instr_is_unreachable(result_loc) || type_is_invalid(result_loc->value.type)) + return result_loc; ir_assert(result_loc->value.type->id == ZigTypeIdPointer, &instruction->base); ZigType *actual_elem_type = result_loc->value.type->data.pointer.child_type; if (actual_elem_type->id == ZigTypeIdOptional && implicit_elem_type->id != ZigTypeIdOptional) {