[PATCH] Avoid types with sizeof (type) < __alignof__ (type) in arrays in struct-layout-1 tests

Steve Ellcey sje@cup.hp.com
Thu May 26 18:07:00 GMT 2005


Jakub,

Sorry I didn't reply to this patch earlier but when I use your patch
with my patch that complains when array elements have aligment greater
then their size, I still get 4 failures in the struct-layout tests:

FAIL: tmpdir-gcc.dg-struct-layout-1/t002 c_compat_x_tst.o compile
FAIL: tmpdir-gcc.dg-struct-layout-1/t002 c_compat_y_tst.o compile
FAIL: tmpdir-gcc.dg-struct-layout-1/t027 c_compat_x_tst.o compile
FAIL: tmpdir-gcc.dg-struct-layout-1/t027 c_compat_y_tst.o compile

I tried to understand the generator and see if I could fix this myself
but haven't had much luck.  I looked at the t002 failure and found
that the source for t002_test.h contains:

T(582,void * atal8 a[2];double b;unsigned short int c;,F(582,a[0],(void *)&intarray[78],(void *)&intarray[187])F(582,b,198407.656250,218547.203125)F(582,c,55499U,5980U))

which after preprocessing results in:

struct S582 { void * __attribute__((aligned (8))) a[2];double b;unsigned short i
nt c; } ;

obviously the array 'a' as an alignment greater than its element size.

Is this something you can fix?

Steve Ellcey
sje@cup.hp.com



More information about the Gcc-patches mailing list