arocc icon indicating copy to clipboard operation
arocc copied to clipboard

`Type.alingof` does not take target into account

Open TwoClocks opened this issue 3 years ago • 1 comments

This works running clang-14 -c --target=i386-linux-gnu test.c

typedef long long b;

_Static_assert(sizeof(b) == 8, "");
_Static_assert(_Alignof(b) == 4, "");

but arocc thinks the alignment is 8

TwoClocks avatar Aug 15 '22 20:08 TwoClocks

It looks like the alignof function in Type.zig is returning the wrong value - it returns 8 for everything except msp430 (should be 4 for i386). From a quick glance at Zig's type.zig (which we aren't using) it looks like it would compute the wrong value there as well

ehaas avatar Aug 16 '22 00:08 ehaas