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
1898218982 if (type_is_invalid(result_loc->value->type) || result_loc->value->type->id == ZigTypeIdUnreachable) {
1898318983 return result_loc;
1898418984 }
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,
1898618986 get_pointer_to_type(ira->codegen, frame_type, false));
1898718987 if (type_is_invalid(result_loc->value->type))
1898818988 return ira->codegen->invalid_inst_gen;
......@@ -19967,14 +19967,16 @@ static IrInstGen *ir_analyze_call_extra(IrAnalyze *ira, IrInst* source_instr,
1996719967 return ira->codegen->invalid_inst_gen;
1996819968
1996919969 IrInstGen *stack = nullptr;
19970 IrInst *stack_src = nullptr;
1997019971 if (stack_is_non_null) {
1997119972 stack = ir_analyze_optional_value_payload_value(ira, source_instr, opt_stack, false);
1997219973 if (type_is_invalid(stack->value->type))
1997319974 return ira->codegen->invalid_inst_gen;
19975 stack_src = &stack->base;
1997419976 }
1997519977
1997619978 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);
1997819980}
1997919981
1998019982static 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 {
11881188 \\ suspend;
11891189 \\}
11901190 , &[_][]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)'",
11921192 });
11931193
11941194 cases.add("@Frame() of generic function",