From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23705 invoked by alias); 1 Aug 2013 19:09:36 -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 23597 invoked by uid 48); 1 Aug 2013 19:09:31 -0000 From: "bernd.edlinger at hotmail dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/58041] Unaligned access to arrays in packed structure Date: Thu, 01 Aug 2013 19:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: wschmidt at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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/msg00048.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58041 --- Comment #16 from Bernd Edlinger --- (In reply to Bill Schmidt from comment #15) > Bernd, Mikael, Martin: Could you please test this on your respective > targets? Congatulations! it works. If I compile with -mno-unaligned-access all accesses are ldrb/strb as it should be. And if I compile with -mcpu=cortex-a9 -munaligned-access the code is also OK, no ldmia's any more. The back end seems to have fixed that for us. foo: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. add ip, r0, r1, asl #3 ldr r0, [ip, #1] @ unaligned ldr r1, [ip, #5] @ unaligned str r2, [ip, #1] @ unaligned str r3, [ip, #5] @ unaligned bx lr which is perfectly OK for cortex-a9.