authorgravatar for timonkruiper@gmail.comTimon Kruiper <timonkruiper@gmail.com> 2020-04-01 20:38:32+02:00
committergravatar for timonkruiper@gmail.comTimon Kruiper <timonkruiper@gmail.com> 2020-04-01 20:38:32+02:00
logd9cf779b47573f750f9e6ffb6373bfcb75b1632e
tree4c2d41d9fb91ac9ca73a65aaf97c041f79a1607f
parenta5af78c376fc41424b81ea83766b38a0a1d17870

Fix some nullptr dereferences on arm-linux-musleabhif


2 files changed, 5 insertions(+), 3 deletions(-)

src/ir.cpp+4-2
...@@ -18982,7 +18982,7 @@ static IrInstGen *ir_analyze_async_call(IrAnalyze *ira, IrInst* source_instr, Zi...@@ -18982,7 +18982,7 @@ static IrInstGen *ir_analyze_async_call(IrAnalyze *ira, IrInst* source_instr, Zi
18982 if (type_is_invalid(result_loc->value->type) || result_loc->value->type->id == ZigTypeIdUnreachable) {18982 if (type_is_invalid(result_loc->value->type) || result_loc->value->type->id == ZigTypeIdUnreachable) {
18983 return result_loc;18983 return result_loc;
18984 }18984 }
18985 result_loc = ir_implicit_cast2(ira, &call_result_loc->source_instruction->base, result_loc,18985 result_loc = ir_implicit_cast2(ira, source_instr, result_loc,
18986 get_pointer_to_type(ira->codegen, frame_type, false));18986 get_pointer_to_type(ira->codegen, frame_type, false));
18987 if (type_is_invalid(result_loc->value->type))18987 if (type_is_invalid(result_loc->value->type))
18988 return ira->codegen->invalid_inst_gen;18988 return ira->codegen->invalid_inst_gen;
...@@ -19967,14 +19967,16 @@ static IrInstGen *ir_analyze_call_extra(IrAnalyze *ira, IrInst* source_instr,...@@ -19967,14 +19967,16 @@ static IrInstGen *ir_analyze_call_extra(IrAnalyze *ira, IrInst* source_instr,
19967 return ira->codegen->invalid_inst_gen;19967 return ira->codegen->invalid_inst_gen;
1996819968
19969 IrInstGen *stack = nullptr;19969 IrInstGen *stack = nullptr;
19970 IrInst *stack_src = nullptr;
19970 if (stack_is_non_null) {19971 if (stack_is_non_null) {
19971 stack = ir_analyze_optional_value_payload_value(ira, source_instr, opt_stack, false);19972 stack = ir_analyze_optional_value_payload_value(ira, source_instr, opt_stack, false);
19972 if (type_is_invalid(stack->value->type))19973 if (type_is_invalid(stack->value->type))
19973 return ira->codegen->invalid_inst_gen;19974 return ira->codegen->invalid_inst_gen;
19975 stack_src = &stack->base;
19974 }19976 }
1997519977
19976 return ir_analyze_fn_call(ira, source_instr, fn, fn_type, fn_ref, first_arg_ptr, first_arg_ptr_src,19978 return ir_analyze_fn_call(ira, source_instr, fn, fn_type, fn_ref, first_arg_ptr, first_arg_ptr_src,
19977 modifier, stack, &stack->base, false, args_ptr, args_len, nullptr, result_loc);19979 modifier, stack, stack_src, false, args_ptr, args_len, nullptr, result_loc);
19978}19980}
1997919981
19980static IrInstGen *ir_analyze_instruction_call_extra(IrAnalyze *ira, IrInstSrcCallExtra *instruction) {19982static IrInstGen *ir_analyze_instruction_call_extra(IrAnalyze *ira, IrInstSrcCallExtra *instruction) {
test/compile_errors.zig+1-1
...@@ -1188,7 +1188,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -1188,7 +1188,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
1188 \\ suspend;1188 \\ suspend;
1189 \\}1189 \\}
1190 , &[_][]const u8{1190 , &[_][]const u8{
1191 "tmp.zig:3:5: error: expected type '*@Frame(bar)', found '*@Frame(foo)'",1191 "tmp.zig:3:13: error: expected type '*@Frame(bar)', found '*@Frame(foo)'",
1192 });1192 });
11931193
1194 cases.add("@Frame() of generic function",1194 cases.add("@Frame() of generic function",