aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2020-10-20 08:53:21 +0200
committerAldy Hernandez <aldyh@redhat.com>2020-10-20 10:33:48 +0200
commitf0c0f124ebe28b71abccbd7247678c9ac608b649 (patch)
tree759d63dbd207a341d313783ca8783e97d9c120af /gcc
parent8f70460005d4fe3f8784000c631449c09c8ce57a (diff)
downloadgcc-f0c0f124ebe28b71abccbd7247678c9ac608b649.zip
gcc-f0c0f124ebe28b71abccbd7247678c9ac608b649.tar.gz
gcc-f0c0f124ebe28b71abccbd7247678c9ac608b649.tar.bz2
Special case shifting by zero in operator_rshift::op1_range.
gcc/ChangeLog: * range-op.cc (operator_rshift::op1_range): Special case shifting by zero.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/range-op.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 21d98de..ee62f10 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -1642,6 +1642,11 @@ operator_rshift::op1_range (irange &r,
wi::uhwi (prec, TYPE_PRECISION (TREE_TYPE (shift))),
UNSIGNED))
return false;
+ if (wi::to_wide (shift) == 0)
+ {
+ r = lhs;
+ return true;
+ }
// Folding the original operation may discard some impossible
// ranges from the LHS.