From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17931 invoked by alias); 1 Aug 2013 07:26:31 -0000 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 Received: (qmail 17843 invoked by uid 48); 1 Aug 2013 07:26:26 -0000 From: "bernd.edlinger at hotmail dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/58041] New: Unaligned access to arrays in packed structure Date: Thu, 01 Aug 2013 07:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal 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-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg00005.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58041 Bug ID: 58041 Summary: Unaligned access to arrays in packed structure Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bernd.edlinger at hotmail dot de the attached test case shows unaligned accesses can be generated on arm architecture, despite the -mno-unaligned-access option. This does not happen at -O0 and -Og, but it always happens at at -Os -O1 -O2 and -O3 to name a few. assembler output for foo shows unaligned opcodes: foo: @ Function supports interworking. @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. add ip, r0, r1, asl #3 add r1, ip, #1 ldmia r1, {r0-r1} str r2, [ip, #1] str r3, [ip, #5] bx lr reproduced with latest trunk: $ ../gcc-4.9-20130728/configure --target=arm-eabi --prefix=/home/ed/gnu/arm-eabi --with-newlib --enable-languages=c,c++ --disable-hosted-libstdcxx --disable-__cxa_atexit