aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-12-02 14:49:00 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-12-02 14:49:00 +0000
commitbd170bbcd819a899eace0db56b353702b8d1ae2f (patch)
treec84c5aad5a5a4c998cee77f68adb2a8d68830ab1 /gcc/fold-const.c
parentd47a01516c91f35d0f60d2e636d6e3724ee400b3 (diff)
downloadgcc-bd170bbcd819a899eace0db56b353702b8d1ae2f.zip
gcc-bd170bbcd819a899eace0db56b353702b8d1ae2f.tar.gz
gcc-bd170bbcd819a899eace0db56b353702b8d1ae2f.tar.bz2
re PR tree-optimization/38359 (ICE in set_lattice_value, at tree-ssa-ccp.c:466)
2008-12-02 Richard Guenther <rguenther@suse.de> PR tree-optimization/38359 * fold-const.c (fold_binary): Fold -1 >> x to -1 only for non-negative x. * gcc.c-torture/compile/pr38359.c: New testcase. * gcc.c-torture/execute/shiftopt-1.c: Adjust. From-SVN: r142356
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 8dddca1..93415d8 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -11457,7 +11457,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
case RSHIFT_EXPR:
/* Optimize -1 >> x for arithmetic right shifts. */
- if (integer_all_onesp (arg0) && !TYPE_UNSIGNED (type))
+ if (integer_all_onesp (arg0) && !TYPE_UNSIGNED (type)
+ && tree_expr_nonnegative_p (arg1))
return omit_one_operand (type, arg0, arg1);
/* ... fall through ... */