Different struct @alignOf result from 0.16 to 0.17

This test passes with 0.16 but fails with 0.17.

test {
    const S = struct { a: [*]const u8 };
    try testing.expectEqual(8, @sizeOf(S));
    try testing.expectEqual(8, @alignOf(S)); // fails here with 0.17
}

const std = @import("std");
const testing = std.testing;
$ zig version
0.17.0
$ zig test /tmp/tmp.zig
expected 8, found 4
...

Anyone know where we can learn about this @alignOf change? I’ve read throught the 0.17 release notes and searched them for ‘align’ but none of the 12 occurrences mention any changes to the @alignOf builtin.

I can’t reproduce this #worksonmymachine

2 Likes

Thanks! Hmm thats Wierd. I wonder what could be causing this. The only thing I can think of that I also changed today was I installed glibc-devel.i686 on this machine because I thought it was a solution to a translate-c issue i was having. :thinking:

EDIT:

I mean it seems like it thinks my machine is 32 bit.

1 Like

I found the issue. Zigup installed a 32 bit version of 0.17 for some reason.

EDIT:

Because I accidentally installed a 32 bit version of zigup :joy:. And the translate-c issue i mentioned was also a result of the 32 bit zig version.