------- 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