fix regression in global const alignment

This commit is contained in:
Andrew Kelley 2020-01-09 19:29:51 -05:00
parent fbcee58cfc
commit b6c8fead00
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
3 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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;

View File

@ -24,7 +24,7 @@ comptime {
_ = @import("behavior/bugs/1500.zig");
_ = @import("behavior/bugs/1607.zig");
_ = @import("behavior/bugs/1735.zig");
//_ = @import("behavior/bugs/1741.zig");
_ = @import("behavior/bugs/1741.zig");
_ = @import("behavior/bugs/1851.zig");
_ = @import("behavior/bugs/1914.zig");
_ = @import("behavior/bugs/2006.zig");