The new MinGW-w64 4.7.3 gcc apparently ignores __attribute__((packed)). Cygwin's gcc 4.7.3 and older MinGW-w64 4.5.3 work as expected.

Testcase:

$ cat packed.c
struct packed { char a; short b; } __attribute__((packed));
int size = sizeof(struct packed);


$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (GCC) 4.7.3
...
$ i686-w64-mingw32-gcc -S packed.c

$ cat packed.s
...
_size:
        .long   4


$ gcc --version
gcc (GCC) 4.7.3
...
$ gcc -S packed.c

$ cat packed.s
...
_size:
        .long   3


$ x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc (GCC) 4.5.3
...
$ x86_64-w64-mingw32-gcc -S packed.c

$ cat packed.s
...
size:
        .long   3


If #pragma pack(1) is used instead, it works as expected also with i686-w64-mingw32-gcc 4.7.3.

(Upstream?) bug ?


Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to