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/44199]  New: ppc64 glibc miscompilation
Date: Wed, 19 May 2010 18:27:00 -0000	[thread overview]
Message-ID: <bug-44199-87@http.gcc.gnu.org/bugzilla/> (raw)

vfscanf is miscompiled by gcc 4.4, here is a shorter testcase that is
miscompiled also by 4.6:

extern void *alloca (__SIZE_TYPE__);
extern void bar (long *, char *);

long
foo (long x)
{
  long buf[400];
  char *p = alloca (x);
  bar (buf, p);
  return buf[0];
}

at -O2 -m64 results in:
...
        bl .bar
        nop
        addi 1,31,3328
        ld 3,112(31)
        ld 0,16(1)
        ld 31,-8(1)
        mtlr 0
        blr
Note that sched2 swapped incorrectly the stack frame release and ld 3,112(31),
so the ld insn reads from memory location 3216 below the stack (which is much
lower than 288 bytes of ppc64 red zone).
If a signal comes in in between addi and ld and something clobbers the stack,
this function (or, with 4.4 vfscanf) will return incorrect value.
There is nothing in the epilogue stack release insn that would make it a memory
barrier.


-- 
           Summary: ppc64 glibc miscompilation
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          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=44199


             reply	other threads:[~2010-05-19 18:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 18:27 jakub at gcc dot gnu dot org [this message]
2010-05-19 18:31 ` [Bug target/44199] " pinskia at gcc dot gnu dot org
2010-05-19 19:10 ` jakub at gcc dot gnu dot org
2010-05-19 19:10 ` jakub at gcc dot gnu dot org
2010-05-19 19:24 ` jakub at gcc dot gnu dot org
2010-05-19 19:28 ` jakub at gcc dot gnu dot org
2010-05-19 20:32 ` jakub at gcc dot gnu dot org
2010-05-19 21:53 ` bergner at gcc dot gnu dot org
2010-05-20  4:31 ` amodra at gmail dot com
2010-05-20 16:23 ` pthaugen at gcc dot gnu dot org
2010-05-20 16:32 ` jakub at gcc dot gnu dot org
2010-05-20 18:00 ` pthaugen at gcc dot gnu dot org
2010-05-20 18:24 ` jakub at gcc dot gnu dot org
2010-05-21  2:33 ` pthaugen at gcc dot gnu dot org
2010-05-21  8:08 ` jakub at gcc dot gnu dot org
2010-05-21 19:14 ` bergner at gcc dot gnu dot org
2010-05-21 19:24 ` iains at gcc dot gnu dot org
2010-05-22 13:31 ` dominiq at lps dot ens dot fr
2010-05-26  6:01 ` jakub at gcc dot gnu dot org
2010-05-26  6:03 ` jakub at gcc dot gnu dot org
2010-05-26  6:06 ` jakub at gcc dot gnu dot org
2010-05-26  6:08 ` jakub at gcc dot gnu dot org
2010-05-26 15:52 ` pthaugen at gcc dot gnu dot org
2010-05-26 16:10 ` jakub at gcc dot gnu dot org
2010-05-26 16:10 ` jakub at gcc dot gnu dot org
2010-05-27 16:31 ` bergner at gcc dot gnu dot org
2010-06-02 15:41 ` bergner 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-44199-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).