http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59259
Bug ID: 59259 Summary: [x32] Incorrect packing and/or alignment when using a 64 bit type as array of zero length in a structure Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: cjanderson at yandex dot com I believe that x32 has 32 bit pointers. I hope that I am not barking up the wrong tree, but I have a problem with gcc versions 4.7.2 4.8.3 and the current head on git with the following: struct blah { long long a,b; }; struct ipt_get_entries { unsigned int size; struct blah entrytable[0]; }; int x = sizeof(struct ipt_get_entries); which produces the following when compiled with the -mx32 flag. ie. cc1 -mx32 produces: .file "1.c" .globl x .data .align 4 .type x, @object .size x, 4 x: .long 8 .ident "GCC: (GNU) 4.9.0 20131120 (experimental)" .section .note.GNU-stack,"",@progbits When compiled with the -m32 flag the size is 4 and with the -m64 flag the size is 8. However, if you change the blah struct to a 32 bit value, ie struct blah { long long a,b; }; ... The result for x is 4. Also, when using -fpack-struct=4 the value of 4 is given, for all of -mx32 -m32 and -m64. The behaviour here seems to be that x32 is doing the same as for 64 bit. Is this correct.