authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-12-16 19:53:05+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-16 15:54:06-05:00
logde0d8885b4623dab14c379fc844ae0b18d9f8405
tree202f3bd2eab8417c6d20878ef971aa7c437eb652
parent170de5ecae27373149db247ca0cff464e090e31b

Fix alignment query on unresolved types

Fixes #3919

1 files changed, 6 insertions(+), 1 deletions(-)

src/ir.cpp+6-1
......@@ -26983,6 +26983,8 @@ static IrInstruction *ir_analyze_bit_cast(IrAnalyze *ira, IrInstruction *source_
2698326983static IrInstruction *ir_analyze_int_to_ptr(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target,
2698426984 ZigType *ptr_type)
2698526985{
26986 Error err;
26987
2698626988 ir_assert(get_src_ptr_type(ptr_type) != nullptr, source_instr);
2698726989 ir_assert(type_has_bits(ptr_type), source_instr);
2698826990
......@@ -27002,7 +27004,10 @@ static IrInstruction *ir_analyze_int_to_ptr(IrAnalyze *ira, IrInstruction *sourc
2700227004 return ira->codegen->invalid_instruction;
2700327005 }
2700427006
27005 const uint32_t align_bytes = get_ptr_align(ira->codegen, ptr_type);
27007 uint32_t align_bytes;
27008 if ((err = resolve_ptr_align(ira, ptr_type, &align_bytes)))
27009 return ira->codegen->invalid_instruction;
27010
2700627011 if (addr != 0 && addr % align_bytes != 0) {
2700727012 ir_add_error(ira, source_instr,
2700827013 buf_sprintf("pointer type '%s' requires aligned address",