From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25571 invoked by alias); 15 Feb 2013 13:09:04 -0000 Received: (qmail 22261 invoked by uid 48); 15 Feb 2013 13:08:43 -0000 From: "bernd.edlinger at hotmail dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/56341] New: GCC produces unaligned data access Date: Fri, 15 Feb 2013 13:09: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: bernd.edlinger at hotmail dot de 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: 2013-02/txt/msg01585.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56341 Bug #: 56341 Summary: GCC produces unaligned data access Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: bernd.edlinger@hotmail.de Created attachment 29464 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29464 test program produces alignment faults Hello, The attached test program causes two problems when compiled with GCC 4.6.3 for ARM: 1. test() fails to write the high word of an unaligned volatile struct member. 2. test1() crashes because it uses an unaligned word access. This code did compile and execute correctly with GCC 4.3.2 As a workaround, the bug goes away if the code is compiled with -fno-strict-volatile-bitfields, but this is probably less efficient code. The attached patch is a backport of the following patch, and seems to resolve this issue: http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01449.html the original patch ignored the alignment of the target, and fixed only the first test case, but not the crash in the second test case. Regards Bernd Edlinger