From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23505 invoked by alias); 3 Dec 2011 18:37:20 -0000 Received: (qmail 23496 invoked by uid 22791); 3 Dec 2011 18:37:20 -0000 X-SWARE-Spam-Status: No, hits=-2.9 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; Sat, 03 Dec 2011 18:37:07 +0000 From: "mikpe at it dot uu.se" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/51315] gcc 4.6.2 miscompilation with -ftree-sra (included in -O2) on Debian/sparc Date: Sat, 03 Dec 2011 18:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-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: CC Message-ID: 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 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: 2011-12/txt/msg00259.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51315 Mikael Pettersson changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #5 from Mikael Pettersson 2011-12-03 18:35:26 UTC --- (In reply to comment #3) > I suspect it's a dupe of PR50569 or PR50444. It's not, this one is caused by r161655 (Richard G's big MEM-REF change): http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg00006.html Comparing the code from r161654 and r161655, targeting sparc-linux, we see: --- pr51315.s-r161654 2011-12-03 18:58:02.000000000 +0100 +++ pr51315.s-r161655 2011-12-03 19:12:41.000000000 +0100 @@ -22,7 +22,7 @@ .type pack_unpack, #function .proc 04 pack_unpack: - save %sp, -104, %sp + save %sp, -96, %sp call strlen, 0 mov %i1, %o0 add %i1, %o0, %i5 @@ -35,7 +35,7 @@ .LL12: cmp %g1, 115 be,a .LL11 - ldub [%i0], %g2 + lduh [%i0], %o0 cmp %i5, %i1 .LL14: bleu,a .LL13 @@ -48,16 +48,8 @@ cmp %g1, 108 bne .LL12 add %i1, 1, %i1 - ldub [%i0], %g4 - ldub [%i0+1], %g3 - ldub [%i0+2], %g2 - ldub [%i0+3], %g1 - stb %g4, [%fp-8] - stb %g3, [%fp-7] - stb %g2, [%fp-6] - stb %g1, [%fp-5] call do_something, 0 - ld [%fp-8], %o0 + ld [%i0], %o0 cmp %i5, %i1 bgu .LL8 add %i0, 4, %i0 @@ -67,12 +59,10 @@ restore .LL11: .LL6: - ldub [%i0+1], %g1 - stb %g2, [%fp-2] - stb %g1, [%fp-1] add %i0, 2, %i0 + sll %o0, 16, %o0 call do_something, 0 - ldsh [%fp-2], %o0 + sra %o0, 16, %o0 b .LL14 cmp %i5, %i1 .size pack_unpack, .-pack_unpack > (And if you hate alignment bugs like me you might also want to know about the > 4.5-only PR46483.) Minor correction: PR46483 also affects gcc-4.4.