http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
Bug #: 52991 Summary: attribute packed broken on mingw32? Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: sher...@netfarm.it I've switched form mingw gcc 4.6.2 to 4.7.0 and I've noticed that attribute packed does not work anymore as expected, simple testcase: #include <stdio.h> #include <stdlib.h> #include <inttypes.h> typedef struct st_tag { uint16_t head __attribute__ ((packed)); uint8_t type; uint16_t flags __attribute__ ((packed)); } st; int main(void) { st x; printf("Structure packing got %u offset, expected 3\n", (unsigned)((char*)&x.flags - (char*)&x)); return 0; } the generated asm is: movl $4, 4(%esp) movl $LC0, (%esp) call _printf the value is 3 in gcc 4.6.2 Using built-in specs. COLLECT_GCC=c:\mingw\bin\gcc-4.7.exe COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.7.0/lto-wrapper.exe Target: i686-pc-mingw32 Configured with: ../gcc-4.7.0/configure --prefix=/mingw --disable-bootstrap --enable-lto --with-pkgversion=Sherpya --with-bugurl=http://oss.netfarm.it/ --target=i686-pc-mingw32 --enable-targets=i686-pc-mingw32 --with-tune=generic --with-cpu=i686 --disable-win32-registry --disable-shared --program-suffix=-4.7 --enable-version-specific-runtime-libs --enable-languages=c,c++ --disable-werror --enable-threads=win32 --with-dwarf2 --disable-nls Thread model: win32 gcc version 4.7.0 (Sherpya) I don't think save-temps output may be relevant