--- /dev/null
+--- gcc.old/gcc/simplify-rtx.c 2005-03-23 15:41:59.000000000 +0100
++++ gcc.dev/gcc/simplify-rtx.c 2007-01-30 11:42:38.407017680 +0100
+@@ -2607,18 +2607,18 @@
+ a register or a CONST_INT, this can't help; testing for these cases will
+ prevent infinite recursion here and speed things up.
+
+- If CODE is an unsigned comparison, then we can never do this optimization,
+- because it gives an incorrect result if the subtraction wraps around zero.
+- ANSI C defines unsigned operations such that they never overflow, and
+- thus such cases can not be ignored. */
++ We can only do this for EQ and NE comparisons as otherwise we may
++ lose or introduce overflow which we cannot disregard as undefined as
++ we do not know the signedness of the operation on either the left or
++ the right hand side of the comparison. */
+
+ if (INTEGRAL_MODE_P (mode) && trueop1 != const0_rtx
++ && (code == EQ || code == NE)
+ && ! ((GET_CODE (op0) == REG || GET_CODE (trueop0) == CONST_INT)
+ && (GET_CODE (op1) == REG || GET_CODE (trueop1) == CONST_INT))
+ && 0 != (tem = simplify_binary_operation (MINUS, mode, op0, op1))
+- /* We cannot do this for == or != if tem is a nonzero address. */
+- && ((code != EQ && code != NE) || ! nonzero_address_p (tem))
+- && code != GTU && code != GEU && code != LTU && code != LEU)
++ /* We cannot do this if tem is a nonzero address. */
++ && ! nonzero_address_p (tem))
+ return simplify_relational_operation (signed_condition (code),
+ mode, tem, const0_rtx);
+
--- /dev/null
+--- gcc.old/gcc/toplev.c 2005-03-09 01:50:25.000000000 +0100
++++ gcc.dev/gcc/toplev.c 2007-01-30 12:25:29.644130224 +0100
+@@ -991,7 +991,7 @@
+ int flag_trapv = 0;
+
+ /* Nonzero if signed arithmetic overflow should wrap around. */
+-int flag_wrapv = 0;
++int flag_wrapv = 1;
+
+ /* Nonzero if subexpressions must be evaluated from left-to-right. */
+ int flag_evaluation_order = 0;