]> git.ipfire.org Git - thirdparty/gcc.git/commit
Correctly detect shifts out of range
authorAndrew MacLeod <amacleod@redhat.com>
Mon, 30 Jan 2023 19:59:30 +0000 (14:59 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Mon, 30 Jan 2023 20:00:40 +0000 (15:00 -0500)
commit9dccaeaa586a1634e1f6a0f4c51806f3c3aea63b
treedde4ee48affcc0df19110d192f48bfd5fccb45f8
parent591ec4820aa4e6d757ddc76cae1d92d445daf72c
Correctly detect shifts out of range

get_shift_range was incorrectly communicating that it couldn't calculate
a range when the shift values was always out fo range.  Fix this and
alwasy return [0, 0] when the shift value is always out of range.

PR tree-optimization/108306
gcc/
* range-op.cc (operator_lshift::fold_range): Return [0, 0] not
varying for shifts that are always out of void range.
(operator_rshift::fold_range): Return [0, 0] not
varying for shifts that are always out of void range.

gcc/testsuite/
* gcc.dg/pr108306.c: New.
gcc/range-op.cc
gcc/testsuite/gcc.dg/pr108306.c [new file with mode: 0644]