public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/44200]  New: ppc64 glibc miscompilation
@ 2010-05-19 19:08 jakub at gcc dot gnu dot org
  2010-05-19 19:10 ` [Bug target/44200] " jakub at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-05-19 19:08 UTC (permalink / raw)
  To: gcc-bugs

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=44200


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

* [Bug target/44200] ppc64 glibc miscompilation
  2010-05-19 19:08 [Bug target/44200] New: ppc64 glibc miscompilation jakub at gcc dot gnu dot org
@ 2010-05-19 19:10 ` jakub at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-05-19 19:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2010-05-19 19:09 -------
Sorry.

*** This bug has been marked as a duplicate of 44199 ***


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2010-05-19 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-19 19:08 [Bug target/44200] New: ppc64 glibc miscompilation jakub at gcc dot gnu dot org
2010-05-19 19:10 ` [Bug target/44200] " 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).