public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/35907]  New: [4.3/4.4 Regression] 64-bit power6 glibc miscompilation
@ 2008-04-11 13:57 jakub at gcc dot gnu dot org
  2008-04-11 14:02 ` [Bug target/35907] " jakub at gcc dot gnu dot org
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-11 13:57 UTC (permalink / raw)
  To: gcc-bugs

build_trtable function from posix/regex.c is miscompiled on ppc64-linux with
-mcpu=power6.  The $v31 register is used within the function and is therefore
saved in prologue and restored in epilogue, but as the function uses alloca,
it is restored from different memory slot than it was saved into.
Options used:
-fpreprocessed -quiet -m64 -mcpu=power6 -mno-minimal-toc -mnew-mnemonics
-mlong-double-128 -g -O3 -std=gnu99 -fgnu89-inline -fasynchronous-unwind-tables
-fmerge-all-constants -fpic
The interesting lines in the assembly are:
.build_trtable:
...
        li 0,320
...
        stdu 1,-496(1)
        stvx 31,1,0
        mfvrsave 0
        mr 31,1
...
        ld 0,0(1)
...
        stdu 0,-12304(1)
...
        li 0,320
        lvx 31,1,0
        ld 1,0(1)
...
        blr

The above is with the trunk gcc, but 4.3 is similar.
Unlike this, gcc 4.1 saved the vector register early:
        li 0,-176
        stvx 31,1,0
as first two insns in the routine, before first stdu, and restored after
incrementing stack pointer back:
        ld 1,0(1)
        mr 3,0
        li 0,-176
        lwz 12,-148(1)
        lvx 31,1,0

So, with 4.1.x this works, but with 4.3/trunk $v31 will get the value of a
memory slot 12304 bytes (i.e. the size of alloca) below where it was actually
saved.


-- 
           Summary: [4.3/4.4 Regression] 64-bit power6 glibc miscompilation
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: powerpc64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35907


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2008-04-18 19:15 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-11 13:57 [Bug target/35907] New: [4.3/4.4 Regression] 64-bit power6 glibc miscompilation jakub at gcc dot gnu dot org
2008-04-11 14:02 ` [Bug target/35907] " jakub at gcc dot gnu dot org
2008-04-11 14:26 ` jakub at gcc dot gnu dot org
2008-04-11 14:32 ` jakub at gcc dot gnu dot org
2008-04-11 16:27 ` pinskia at gcc dot gnu dot org
2008-04-11 17:21 ` bergner at gcc dot gnu dot org
2008-04-11 17:34 ` bergner at gcc dot gnu dot org
2008-04-11 18:38 ` jakub at gcc dot gnu dot org
2008-04-11 19:08 ` pinskia at gcc dot gnu dot org
2008-04-11 19:09 ` bergner at gcc dot gnu dot org
2008-04-11 19:20 ` jakub at gcc dot gnu dot org
2008-04-11 22:05 ` bergner at gcc dot gnu dot org
2008-04-14  7:19 ` amodra at bigpond dot net dot au
2008-04-14  7:31 ` jakub at gcc dot gnu dot org
2008-04-14 10:26 ` amodra at bigpond dot net dot au
2008-04-15  9:26 ` jakub at gcc dot gnu dot org
2008-04-15 12:35 ` jakub at gcc dot gnu dot org
2008-04-15 14:37 ` bergner at gcc dot gnu dot org
2008-04-15 21:16 ` bergner at gcc dot gnu dot org
2008-04-16  0:42 ` amodra at bigpond dot net dot au
2008-04-16  0:44 ` pinskia at gcc dot gnu dot org
2008-04-17  7:21 ` jakub at gcc dot gnu dot org
2008-04-17 12:29 ` amodra at gcc dot gnu dot org
2008-04-17 12:29 ` amodra at gcc dot gnu dot org
2008-04-17 12:30 ` amodra at bigpond dot net dot au
2008-04-18 19:13 ` jakub at gcc dot gnu dot org
2008-04-18 19:15 ` jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).