public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: richard@wetafx.co.nz
To: gcc-gnats@gcc.gnu.org
Subject: optimization/9736: same fp comparison can lead to different results
Date: Mon, 17 Feb 2003 23:16:00 -0000 [thread overview]
Message-ID: <20030217231257.10430.qmail@sources.redhat.com> (raw)
>Number: 9736
>Category: optimization
>Synopsis: same fp comparison can lead to different results
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Mon Feb 17 23:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: richard@wetafx.co.nz
>Release: g++3 (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>Organization:
>Environment:
Linux 2.4.18-xfssmp #1 SMP i686
>Description:
//////////bug.cc:
void access(const float&) {}
int test(float t)
{
float v = 0.75f+t;
int test1 = v < 1.0f ? 1 : 2;
int test2 = v < 1.0f ? 1 : 2;
access(v);
return test1*10+test2;
}
int main(void) { return test(0.25f-1.0f/67108864.0f); }
//////////GNUmakefile
bug: bug.cc; g++3 -O1 -o bug bug.cc
>How-To-Repeat:
With the two specified files, use gmake to build.
With -O1, the values computed for test1 and test2
are different while the source code is identical.
>Fix:
Can use the -ffloat-store option, but that is a mighty
big hammer.
>Release-Note:
>Audit-Trail:
>Unformatted:
next reply other threads:[~2003-02-17 23:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-17 23:16 richard [this message]
2003-02-18 8:04 ebotcazou
2003-02-18 22:16 Richard Addison-Wood
2003-02-19 9:06 Eric Botcazou
2003-02-19 14:06 Tim Prince
2003-02-27 7:46 Richard Addison-Wood
2003-03-05 3:26 Richard Addison-Wood
2003-03-05 7:46 ebotcazou
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=20030217231257.10430.qmail@sources.redhat.com \
--to=richard@wetafx.co.nz \
--cc=gcc-gnats@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).