diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-01-09 19:29:51 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-01-16 21:58:51 -0500 |
| commit | b6c8fead00aa5d7b39697aedb0cb1eef53010b83 (patch) | |
| tree | 1c91dd3aff35d3334f8fdf8b1f37d6246974a564 /src | |
| parent | fbcee58cfcabddd3e0842e22141a983a8169502f (diff) | |
| download | zig-b6c8fead00aa5d7b39697aedb0cb1eef53010b83.tar.gz zig-b6c8fead00aa5d7b39697aedb0cb1eef53010b83.zip | |
fix regression in global const alignment
Diffstat (limited to 'src')
| -rw-r--r-- | src/analyze.cpp | 2 | ||||
| -rw-r--r-- | src/ir.cpp | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 435020014d..fe0b396d28 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -9303,7 +9303,9 @@ bool type_has_optional_repr(ZigType *ty) { } void copy_const_val(ZigValue *dest, ZigValue *src) { + uint32_t prev_align = dest->llvm_align; memcpy(dest, src, sizeof(ZigValue)); + dest->llvm_align = prev_align; if (src->special != ConstValSpecialStatic) return; dest->parent.id = ConstParentIdNone; diff --git a/src/ir.cpp b/src/ir.cpp index 67bd463644..a1e8f9c43b 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -17052,6 +17052,7 @@ static IrInstruction *ir_analyze_alloca(IrAnalyze *ira, IrInstruction *source_in ZigValue *pointee = create_const_vals(1); pointee->special = ConstValSpecialUndef; + pointee->llvm_align = align; IrInstructionAllocaGen *result = ir_build_alloca_gen(ira, source_inst, align, name_hint); result->base.value->special = ConstValSpecialStatic; |
