------- Comment #4 from rguenth at gcc dot gnu dot org 2006-06-25 12:02 ------- .003.original is already wrong:
t0 = *((float *) (i * 0fffffffc) + corr) * (float) *ww-- ; we ask fold to fold (unsigned)-i * 4U which continues to ask fold to fold i * -4U (buggy already), which is from case MULT_EXPR: /* (-A) * (-B) -> A * B */ if (TREE_CODE (arg0) == NEGATE_EXPR && negate_expr_p (arg1)) return fold_build2 (MULT_EXPR, type, TREE_OPERAND (arg0, 0), negate_expr (arg1)); it should use fold_convert () on the args. The following fixes it: Index: fold-const.c =================================================================== --- fold-const.c (revision 114974) +++ fold-const.c (working copy) @@ -8866,12 +8866,12 @@ fold_binary (enum tree_code code, tree t /* (-A) * (-B) -> A * B */ if (TREE_CODE (arg0) == NEGATE_EXPR && negate_expr_p (arg1)) return fold_build2 (MULT_EXPR, type, - TREE_OPERAND (arg0, 0), - negate_expr (arg1)); + fold_convert (type, TREE_OPERAND (arg0, 0)), + fold_convert (type, negate_expr (arg1))); if (TREE_CODE (arg1) == NEGATE_EXPR && negate_expr_p (arg0)) return fold_build2 (MULT_EXPR, type, - negate_expr (arg0), - TREE_OPERAND (arg1, 0)); + fold_convert (type, negate_expr (arg0)), + fold_convert (type, TREE_OPERAND (arg1, 0))); if (! FLOAT_TYPE_P (type)) { (obvious, but has to wait until after the summit.) -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2006-06-25 10:30:15 |2006-06-25 12:02:00 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28162