This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/51315] gcc 4.6.2 miscompilation with -ftree-sra (included in -O2) on Debian/sparc
- From: "mikpe at it dot uu.se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 03 Dec 2011 18:35:26 +0000
- Subject: [Bug tree-optimization/51315] gcc 4.6.2 miscompilation with -ftree-sra (included in -O2) on Debian/sparc
- Auto-submitted: auto-generated
- References: <bug-51315-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51315
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #5 from Mikael Pettersson <mikpe at it dot uu.se> 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.