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