+2007-10-31 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/33779
+ * fold-const.c (extract_muldiv_1): Make sure to not introduce
+ new undefined integer overflow.
+ (fold_binary): Avoid useless conversion.
+
2007-10-31 Richard Sandiford <rsandifo@nildram.co.uk>
PR target/33948
then we cannot pass through this conversion. */
|| (code != MULT_EXPR
&& (TYPE_UNSIGNED (ctype)
- != TYPE_UNSIGNED (TREE_TYPE (op0))))))
+ != TYPE_UNSIGNED (TREE_TYPE (op0))))
+ /* ... or has undefined overflow while the converted to
+ type has not, we cannot do the operation in the inner type
+ as that would introduce undefined overflow. */
+ || (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (op0))
+ && !TYPE_OVERFLOW_UNDEFINED (type))))
break;
/* Pass the constant down and see if we can make a simplification. If
strict_overflow_p = false;
if (TREE_CODE (arg1) == INTEGER_CST
- && 0 != (tem = extract_muldiv (op0,
- fold_convert (type, arg1),
- code, NULL_TREE,
+ && 0 != (tem = extract_muldiv (op0, arg1, code, NULL_TREE,
&strict_overflow_p)))
{
if (strict_overflow_p)
+2007-10-31 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/33779
+ * gcc.c-torture/execute/pr33779-1.c: New testcase.
+ * gcc.c-torture/execute/pr33779-2.c: Likewise.
+
2007-10-31 Paul Thomas <pault@gcc.gnu.org>
PR fortran/33897