From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29201 invoked by alias); 15 Apr 2012 04:21:41 -0000 Received: (qmail 29192 invoked by uid 22791); 15 Apr 2012 04:21:39 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 15 Apr 2012 04:21:26 +0000 From: "sherpya at netfarm dot it" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/52991] New: attribute packed broken on mingw32? Date: Sun, 15 Apr 2012 04:21:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: sherpya at netfarm dot it X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg01153.txt.bz2 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: unassigned@gcc.gnu.org ReportedBy: sherpya@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 #include #include 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