public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/40906]  New: Wrong code generated for push of long double
@ 2009-07-29 17:04 mikulas at artax dot karlin dot mff dot cuni dot cz
  2009-07-29 17:07 ` [Bug rtl-optimization/40906] " mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mikulas at artax dot karlin dot mff dot cuni dot cz @ 2009-07-29 17:04 UTC (permalink / raw)
  To: gcc-bugs

Hi. Try this program:

#include <stdlib.h>

void f(long double a)
{
        if (a != 1.0) abort();
}

int g(long double b)
{
        f(b);
        return 0;
}

int main(void)
{
        g(1.0);
        return 0;
}

Compile it with "-O2 -mpush-args -mno-accumulate-outgoing-args
-fomit-frame-pointer -fno-inline"

In gcc 4.3.2 it works, in gcc-4.4.1 it aborts. If you add -m128bit-long-double,
both gcc 4.3 and 4.4 fail. The reason is that push of long double in the
function "g" is badly generated --- it is pushing value that is already on the
stack and while it is pushing it, the stack pointer changes. Gcc tries to
compensate for it, but the code is buggy and it ends up pushing wrong words.


-- 
           Summary: Wrong code generated for push of long double
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2009-08-05 21:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-29 17:04 [Bug rtl-optimization/40906] New: Wrong code generated for push of long double mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-29 17:07 ` [Bug rtl-optimization/40906] " mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-29 18:15 ` [Bug target/40906] " rguenth at gcc dot gnu dot org
2009-08-05 14:42 ` uros at gcc dot gnu dot org
2009-08-05 18:05 ` uros at gcc dot gnu dot org
2009-08-05 21:17 ` uros at gcc dot gnu dot org
2009-08-05 21:19 ` ubizjak at gmail dot com

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).