Skip to content

Commit

Permalink
fixes resolving aligment of child type in slice
Browse files Browse the repository at this point in the history
  • Loading branch information
Hejsil authored and andrewrk committed Jun 16, 2019
1 parent 7c5ceb0 commit aa60d2a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ir.cpp
Expand Up @@ -16794,7 +16794,7 @@ static IrInstruction *ir_analyze_instruction_slice_type(IrAnalyze *ira,
case ZigTypeIdPromise:
case ZigTypeIdVector:
{
if ((err = type_resolve(ira->codegen, child_type, ResolveStatusZeroBitsKnown)))
if ((err = type_resolve(ira->codegen, child_type, ResolveStatusAlignmentKnown)))
return ira->codegen->invalid_instruction;
ZigType *slice_ptr_type = get_pointer_to_type_extra(ira->codegen, child_type,
is_const, is_volatile, PtrLenUnknown, align_bytes, 0, 0, is_allow_zero);
Expand Down
1 change: 1 addition & 0 deletions test/stage1/behavior.zig
Expand Up @@ -27,6 +27,7 @@ comptime {
_ = @import("behavior/bugs/2114.zig");
_ = @import("behavior/bugs/2346.zig");
_ = @import("behavior/bugs/2578.zig");
_ = @import("behavior/bugs/2689.zig");
_ = @import("behavior/bugs/394.zig");
_ = @import("behavior/bugs/421.zig");
_ = @import("behavior/bugs/529.zig");
Expand Down
7 changes: 7 additions & 0 deletions test/stage1/behavior/bugs/2689.zig
@@ -0,0 +1,7 @@
test "slice with alignment" {
const S = packed struct {
a: u8,
};

var a: []align(8) S = undefined;
}

0 comments on commit aa60d2a

Please sign in to comment.