On Fri, May 01, 2015 at 11:30:53PM -0400, tbsaunde+...@tbsaunde.org wrote:
> +    AC_TRY_COMPILE(
> +      [struct foo1 { char x; char :0; char y; };
> +struct foo2 { char x; int :0; char y; };
> +int foo1test[ sizeof (struct foo1) == 2 ? 1 : -1 ];
> +int foo2test[ sizeof (struct foo2) == 5 ? 1 : -1]; ],

Shouldn't the 5 be sizeof (int) + 1?  I mean, we have targets with 16-bit
ints.  I hope no target sizeof (int) == 1, that would break this test too
(perhaps you could use long long  :0; instead?).
Also, the anon bitfield changes alignment only on a subset of targets:
targetm.align_anon_bitfield ()
says if it makes a difference.
So, wouldn't it be better to test instead if
struct C { char a; char b : 1; char c; };
struct D { char a; long long b : 1; char c; };
int footest[sizeof (struct C) < sizeof (struct D)] ? 1 : -1];
?  Tested that it works with powerpc compiler with -mbit-align vs.
-mno-bit-align.

        Jakub

Reply via email to