public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/35907]  New: [4.3/4.4 Regression] 64-bit power6 glibc miscompilation
Date: Fri, 11 Apr 2008 13:57:00 -0000	[thread overview]
Message-ID: <bug-35907-87@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2008-04-11 13:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-11 13:57 jakub at gcc dot gnu dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-35907-87@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).