This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34333] if(nan == nan) wrongly returns TRUE, when nan is a parameter
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Dec 2007 14:00:24 -0000
- Subject: [Bug fortran/34333] if(nan == nan) wrongly returns TRUE, when nan is a parameter
- References: <bug-34333-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from burnus at gcc dot gnu dot org 2007-12-04 14:00 -------
Created an attachment (id=14697)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14697&action=view)
Test case and partial patch
Attached you find a patch for simplify.c's min/max and for the comparison of
complex numbers.
The comparison for real numbers needs some work: Currently, the actual
comparison is done in gfc_compare_expr, however, the result is used at several
places. Especially result > 0 and result < 0 is used.
"nan < nan", "nan == nan" and "nan > nan" is all false thus one needs to take
care of the NaN at different places.
For compare_complex one can use mpfr_equal_p as there is no order for complex
functions.
One should consider removing the REAL check from gfc_compare_expr and add
special cases for BT_REAL using mpfr_equal_p, mpfr_greater_p etc. to the
various callers of gfc_compare_expr.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34333