From f0c0f124ebe28b71abccbd7247678c9ac608b649 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Tue, 20 Oct 2020 08:53:21 +0200 Subject: [PATCH] Special case shifting by zero in operator_rshift::op1_range. gcc/ChangeLog: * range-op.cc (operator_rshift::op1_range): Special case shifting by zero. --- gcc/range-op.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 21d98de22406..ee62f103598a 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.