diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-12-16 19:53:05 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-12-16 15:54:06 -0500 |
| commit | de0d8885b4623dab14c379fc844ae0b18d9f8405 (patch) | |
| tree | 202f3bd2eab8417c6d20878ef971aa7c437eb652 /src/ir.cpp | |
| parent | 170de5ecae27373149db247ca0cff464e090e31b (diff) | |
| download | zig-de0d8885b4623dab14c379fc844ae0b18d9f8405.tar.gz zig-de0d8885b4623dab14c379fc844ae0b18d9f8405.zip | |
Fix alignment query on unresolved types
Fixes #3919
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 056f6a903b..e126ca9bce 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -26983,6 +26983,8 @@ static IrInstruction *ir_analyze_bit_cast(IrAnalyze *ira, IrInstruction *source_ static IrInstruction *ir_analyze_int_to_ptr(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target, ZigType *ptr_type) { + Error err; + ir_assert(get_src_ptr_type(ptr_type) != nullptr, source_instr); ir_assert(type_has_bits(ptr_type), source_instr); @@ -27002,7 +27004,10 @@ static IrInstruction *ir_analyze_int_to_ptr(IrAnalyze *ira, IrInstruction *sourc return ira->codegen->invalid_instruction; } - const uint32_t align_bytes = get_ptr_align(ira->codegen, ptr_type); + uint32_t align_bytes; + if ((err = resolve_ptr_align(ira, ptr_type, &align_bytes))) + return ira->codegen->invalid_instruction; + if (addr != 0 && addr % align_bytes != 0) { ir_add_error(ira, source_instr, buf_sprintf("pointer type '%s' requires aligned address", |
