From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2342 invoked by alias); 29 Sep 2010 19:41:23 -0000 Received: (qmail 2328 invoked by uid 22791); 29 Sep 2010 19:41:22 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID,TW_DR 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; Wed, 29 Sep 2010 19:41:18 +0000 From: "mikpe at it dot uu.se" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/45813] alias analysis problem ? X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mikpe at it dot uu.se 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: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 30 Sep 2010 01:18:00 -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 X-SW-Source: 2010-09/txt/msg03160.txt.bz2 Message-ID: <20100930011800.0VlE1QUUuq08Puc59ba_X8wJ6eGMQBXGIS8aKNQAtZw@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45813 --- Comment #9 from Mikael Pettersson 2010-09-29 19:41:08 UTC --- I can reproduce it with crosses to arm-elf and arm-linux-gnueabi. The combination of -mthumb (1 not 2) and -fno-omit-frame-pointer is the trigger. GCC 4.3.5 works, 4.4 and 4.5 generate broken code, 4.6 works. gcc-4.3.5 -march=armv5te -mthumb -fno-omit-frame-pointer -Os generates: ReadLE16U: push {r7, lr} ldrb r3, [r0] sub sp, sp, #8 add r7, sp, #0 add r2, r7, #6 strb r3, [r2] ldrb r3, [r0, #1] mov sp, r7 add sp, sp, #8 strb r3, [r2, #1] ldrh r0, [r2] @ sp needed for prologue pop {r7, pc} The second byte is correctly stored before the short is read and returned. gcc-4.4-20100928 and gcc-4.5-20100923 generate: ReadLE16U: push {r7, lr} ldrb r2, [r0] sub sp, sp, #8 add r7, sp, #0 add r3, r7, #6 mov sp, r7 strb r2, [r3] add sp, sp, #8 ldrb r2, [r0, #1] @ sp needed for prologue ldrh r0, [r3] pop {r7, pc} The second byte is read but not written before the short is read. gcc-4.6-20100925 generates: ReadLE16U: push {r0, r1, r7, lr} ldrb r3, [r0] add r7, sp, #0 mov sp, r7 strb r3, [r7, #6] ldrb r3, [r0, #1] @ sp needed for prologue strb r3, [r7, #7] ldrh r0, [r7, #6] pop {r1, r2, r7, pc} This is correct.