]> git.ipfire.org Git - thirdparty/gcc.git/commit
Correctly detect shifts out of range
authorAndrew MacLeod <amacleod@redhat.com>
Mon, 16 Jan 2023 20:02:51 +0000 (15:02 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Fri, 27 Jan 2023 14:32:42 +0000 (09:32 -0500)
commitf884c133dde519b4d8fc89f2f151711d1b0eb368
tree632798a395c88d7716eb1014daf93ae61afce005
parentec5e99e95954fd629283a9c9572193dd95471fea
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]