------- Comment #23 from rguenth at gcc dot gnu dot org 2010-01-18 15:16 ------- And a fix along comment #14 would be (untested, but of course fixes the testcase):
Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 156009) +++ gcc/fold-const.c (working copy) @@ -1129,10 +1129,14 @@ negate_expr_p (tree t) && TYPE_OVERFLOW_WRAPS (type)); case FIXED_CST: - case REAL_CST: case NEGATE_EXPR: return true; + case REAL_CST: + /* We want to canonicalize to positive real constants. Pretend + that only negative ones can be easily negated. */ + return REAL_VALUE_NEGATIVE (TREE_REAL_CST (t)); + case COMPLEX_CST: return negate_expr_p (TREE_REALPART (t)) && negate_expr_p (TREE_IMAGPART (t)); looks appealing, but let's check for fallout. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19988