aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2014-07-28 08:55:17 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2014-07-28 08:55:17 +0000
commit32b436c0b9ba7050e26f4b9a858a4b186c6998ef (patch)
tree4cbd10b26a3a22de64e5caa3f5a3068b6b4a77ba /gcc/fold-const.c
parent2637bd27e86c30bce73f6753e922b1b2f03ad47d (diff)
downloadgcc-32b436c0b9ba7050e26f4b9a858a4b186c6998ef.zip
gcc-32b436c0b9ba7050e26f4b9a858a4b186c6998ef.tar.gz
gcc-32b436c0b9ba7050e26f4b9a858a4b186c6998ef.tar.bz2
re PR middle-end/61734 (Regression in ABS_EXPR recognition)
PR middle-end/61734 * fold-const.c (fold_comparison): Disable X - Y CMP 0 to X CMP Y for operators other than the equality operators. From-SVN: r213118
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 0999625..7180662 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9026,9 +9026,13 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
/* Transform comparisons of the form X - Y CMP 0 to X CMP Y. */
if (TREE_CODE (arg0) == MINUS_EXPR
- && (equality_code || TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg0)))
+ && equality_code
&& integer_zerop (arg1))
{
+ /* ??? The transformation is valid for the other operators if overflow
+ is undefined for the type, but performing it here badly interacts
+ with the transformation in fold_cond_expr_with_comparison which
+ attempts to synthetize ABS_EXPR. */
if (!equality_code)
fold_overflow_warning ("assuming signed overflow does not occur "
"when changing X - Y cmp 0 to X cmp Y",