Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiling a packed struct with a u0 causes the compiler to abort #1554

Closed
winksaville opened this Issue Sep 18, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@winksaville
Copy link
Contributor

winksaville commented Sep 18, 2018

Command demonstrating abort:

$ zig test u0-packed-struct-fails.zig 
zig: ../src/analyze.cpp:499: ZigType* get_pointer_to_type_extra(CodeGen*, ZigType*, bool, bool, PtrLen, uint32_t, uint32_t, uint32_t): Assertion `byte_alignment == 0' failed.
Aborted (core dumped)

Code here and below:

const assert = @import("std").debug.assert;

// zig: ../src/analyze.cpp:499: ZigType* get_pointer_to_type_extra(CodeGen*, ZigType*, bool, bool, PtrLen, uint32_t, uint32_t, uint32_t): Assertion `byte_alignment == 0' failed.
// Aborted (core dumped)
test "u0-packed-struct-fails" {
    const S = packed struct { f0: u0, };
    var s = S { .f0 = 0, };
    assert(s.f0 == 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.