+2004-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ * fold-const.c (extract_muldiv_1) <case ABS_EXPR>: If ctype is
+ unsigned and type signed, build ABS_EXPR with signed_type (ctype)
+ and only afterwards convert to ctype.
+
2004-11-29 Richard Henderson <rth@redhat.com>
PR target/17224
return t1;
break;
- case NEGATE_EXPR: case ABS_EXPR:
+ case ABS_EXPR:
+ /* If widening the type changes it from signed to unsigned, then we
+ must avoid building ABS_EXPR itself as unsigned. */
+ if (TREE_UNSIGNED (ctype) && !TREE_UNSIGNED (type))
+ {
+ tree cstype = (*lang_hooks.types.signed_type) (ctype);
+ if ((t1 = extract_muldiv (op0, c, code, cstype)) != 0)
+ {
+ t1 = fold (build1 (tcode, cstype, fold_convert (cstype, t1)));
+ return fold_convert (ctype, t1);
+ }
+ break;
+ }
+ /* FALLTHROUGH */
+ case NEGATE_EXPR:
if ((t1 = extract_muldiv (op0, c, code, wide_type)) != 0)
return fold (build1 (tcode, ctype, fold_convert (ctype, t1)));
break;
+2004-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/execute/20041126-1.c: New test.
+
2004-11-27 Falk Hueffner <falk@debian.org>
* gcc.dg/loop-6.c: New test.