public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mikulas at artax dot karlin dot mff dot cuni dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/40906]  New: Wrong code generated for push of long double
Date: Wed, 29 Jul 2009 17:04:00 -0000	[thread overview]
Message-ID: <bug-40906-1600@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2009-07-29 17:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 17:04 mikulas at artax dot karlin dot mff dot cuni dot cz [this message]
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

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-40906-1600@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).