This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20674] New: unexpected result from floating compare
- From: "piaget at us dot ibm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Mar 2005 21:51:01 -0000
- Subject: [Bug c++/20674] New: unexpected result from floating compare
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Small .C program shows a problem where a value of 1.0 is calculated, but that
value falls through 2 if-checks ... one checks for "if (val <= 1.0)" , the next
checks for "if (val > 1.0)" ... one of these if checks must be true but neither
true leg is taken.
problem surfaces at optimization level -O1 (also tested -O2 and -O3 ... same
problem)
problem goes away with -ffloat-store , although I feel this is a logic problem
and not a precision problem.
problem goes away if compiled as .c (with pass-by-reference removed)
g++ -v -save-temps -O1 -o tmp1 tmp1.C
This is my first bug ... I am going to committ ... may add attachments later if
not given the opportunity now
--
Summary: unexpected result from floating compare
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: piaget at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i586-mandrake-linux-gnu
GCC target triplet: i586-mandrake-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20674