From: Aldy Hernandez Date: Tue, 20 Oct 2020 06:53:21 +0000 (+0200) Subject: Special case shifting by zero in operator_rshift::op1_range. X-Git-Tag: basepoints/gcc-12~4142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0c0f124ebe28b71abccbd7247678c9ac608b649;p=thirdparty%2Fgcc.git Special case shifting by zero in operator_rshift::op1_range. gcc/ChangeLog: * range-op.cc (operator_rshift::op1_range): Special case shifting by zero. --- 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.