http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55428
Bug #: 55428 Summary: -mms-bitfields hides -mno-align-double option Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: kasber...@heidenhain.de i686-pc-linux-gbu-gcc -mno-align-double -mms-bitfields test.cpp ("-mno-align-double" is the equivalent to /zp4) This command line ignores the "-mno-align-double" option. With -mno-align-double standalone it will do the correct double alignments but no the ms bitfield alignment (What is expected) If I add -mms-bitfields the alignment for bitfields will be correct but the "-mno-align-double" is now gone Here the program I have tested. Is it possible to achieve binary compatibility to ms compiler with option /zp4 enabled i686-pc-linux-gbu-gcc -mno-align-double -mms-bitfields test.cpp test.cpp:48:58: warning: large integer implicitly truncated to unsigned type [-Woverflow] test.cpp:54:54: warning: large integer implicitly truncated to unsigned type [-Woverflow] i686-pc-linux-gbu-gcc -mno-align-double test.cpp test.cpp:52:53: warning: large integer implicitly truncated to unsigned type [-Woverflow] test.cpp:58:53: warning: large integer implicitly truncated to unsigned type [-Woverflow] i686-pc-linux-gbu-gcc -mms-bitfields test.cpp test.cpp:48:58: warning: large integer implicitly truncated to unsigned type [-Woverflow] test.cpp:54:54: warning: large integer implicitly truncated to unsigned type [-Woverflow] // 8 typedef struct _jhtest1 { unsigned long bf_1 : 12; unsigned long : 0; unsigned long bf_2 : 12; } jhtest1; //?? typedef struct _jhtest2 { char foo : 4; short : 0; char bar; } jhtest2; //?? typedef struct _jhtest3 { char foo : 4; short : 0; double bar; } jhtest3; //4 typedef struct _jhtest4 { char foo : 6; long : 0; } jhtest4; // 2 typedef struct _jhtest5 { char foo; long : 0; char bar; } jhtest5; typedef struct _jhtest { double xx; char y; double yy; long z; } jhtest; unsigned char jh_double = (sizeof (double) == 8 )?1:1111111; unsigned char jh_test0 = (sizeof (jhtest) == (8*2+8) )?1:1111111; unsigned char jh_test1 = (sizeof (jhtest1) == 8 )?1:1111111; unsigned char jh_test2 = (sizeof (jhtest2) == 4 )?1:1111111; // VC++ unsigned char jh_test3 = (sizeof (jhtest3) == 12 )?1:1111111; unsigned char jh_test4 = (sizeof (jhtest4) == 4 )?1:1111111; unsigned char jh_test5 = (sizeof (jhtest5) == 2 )?1:1111111; // VC++ int main() { }