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 middle-end/15945] New: Incorrect floating point optimization
Date: Fri, 11 Jun 2004 16:43:00 -0000	[thread overview]
Message-ID: <20040611164327.15945.jakub@gcc.gnu.org> (raw)

The following testcase is miscompiled with gcc-3_4-branch at -O3 on
s390x-redhat-linux (worked properly in GCC 3.3.x and earlier).

/* { dg-do run { target *-*-linux* } } */
/* { dg-options "-O3 -lm" } */

#include <fenv.h>
#include <stdlib.h>

typedef union
{
  int i[2];
  double x;
} U;

double __attribute__ ((noinline))
foo (double x)
{
  U u, v;

  u.x = x;
  u.i[0] = 0x7ff00000;
  v.i[0] = 0x7ff00000;
  u.i[1] = 0;
  v.i[1] = 0;
  return u.x / v.x;
}

double d;

int
main (void)
{
  feclearexcept (FE_ALL_EXCEPT);
  d = foo (2.0);
  if (fetestexcept (FE_INVALID) == 0)
    abort ();
  return 0;
}

Unless -ffast-math, the division should not be optimized out, as it is supposed
to generate invalid exception.
This causes miscompilation of glibc.

-- 
           Summary: Incorrect floating point optimization
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: s390x-redhat-linux


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


             reply	other threads:[~2004-06-11 16:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-11 16:43 jakub at gcc dot gnu dot org [this message]
2004-06-11 16:55 ` [Bug middle-end/15945] [3.4 Regression] " pinskia at gcc dot gnu dot org
2004-06-11 21:47 ` [Bug middle-end/15945] [3.4/3.5 " pinskia at gcc dot gnu dot org
2004-06-14 17:45 ` cvs-commit at gcc dot gnu dot org
2004-06-14 17:48 ` cvs-commit at gcc dot gnu dot org
2004-06-14 19:18 ` pinskia at gcc dot gnu dot org
2004-06-14 20:25 ` andreas dot meier_ at gmx dot de
2004-06-14 20:33 ` bangerth at dealii 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=20040611164327.15945.jakub@gcc.gnu.org \
    --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).