aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2007-12-11 03:35:39 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2007-12-11 03:35:39 +0000
commitc817ff638d06871d090753c47f0a960a70df47f2 (patch)
tree5108b706c8903a1a66765ad2ecdca3702c6b2371
parentdf954420dd7ee25baf1f5d10e88935b7a70b5a7e (diff)
downloadsrc-c817ff638d06871d090753c47f0a960a70df47f2.tar.gz
src-c817ff638d06871d090753c47f0a960a70df47f2.zip
Do not fold -C*ABS<n> to ABS<-C*n> (i.e., do not move negative constants
inside ABS expression). Obtained from: Richard Guenther <rguenther@suse.de> Approved by: core
Notes
Notes: svn path=/vendor/gcc/dist/; revision=174531
-rw-r--r--contrib/gcc/fold-const.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/gcc/fold-const.c b/contrib/gcc/fold-const.c
index 5db1d843e4f0..ea16eae741b7 100644
--- a/contrib/gcc/fold-const.c
+++ b/contrib/gcc/fold-const.c
@@ -5661,6 +5661,9 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
}
break;
}
+ /* If the constant is negative, we cannot simplify this. */
+ if (tree_int_cst_sgn (c) == -1)
+ break;
/* FALLTHROUGH */
case NEGATE_EXPR:
if ((t1 = extract_muldiv (op0, c, code, wide_type, strict_overflow_p))