[Bug tree-optimization/123109] `a >> (bits-1) != 0` is not optimized to `a < 0` by match
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 1 17:24:18 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123109
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <gjl@gcc.gnu.org>:
https://gcc.gnu.org/g:7a1d4d74e4505c7f44aa8fc90ac9bfc64179309c
commit r17-3827-g7a1d4d74e4505c7f44aa8fc90ac9bfc64179309c
Author: Georg-Johann Lay <avr@gjlay.de>
Date: Tue Sep 1 19:10:01 2026 +0200
Fix sloppy PR123109 tests
gcc.dg/pr123109-vector.c failed with
FAIL: gcc.dg/pr123109-vector.c (test for excess errors)
Excess errors:
gcc.dg/pr123109-vector.c:9:44: warning: right shift count >= width of
vector element [-Wshift-count-overflow]
gcc.dg/pr123109-vector.c:9:44: warning: right shift count >= width of
vector element [-Wshift-count-overflow]
gcc.dg/pr123109-vector.c:12:44: warning: right shift count >= width of
vector element [-Wshift-count-overflow]
gcc.dg/pr123109-vector.c:12:44: warning: right shift count >= width of
vector element [-Wshift-count-overflow]
gcc.dg/pr123109-vector.c: pattern found 0 times
FAIL: gcc.dg/pr123109-vector.c scan-tree-dump-times forwprop2 ">= { 0, 0,
0, 0 }" 2
in the obvious expectation that the vectors have 4 SImode elements.
Hence use __[U]INT32_TYPE__ for the elements instead of [unsigned] int.
Similarly, gcc.dg/pr123109-scalar.c failed with:
FAIL: gcc.dg/pr123109-scalar.c (test for excess errors)
Excess errors:
gcc.dg/pr123109-scalar.c:5:44: warning: right shift count >= width of type
[-Wshift-count-overflow]
gcc.dg/pr123109-scalar.c:5:44: warning: right shift count >= width of type
[-Wshift-count-overflow]
gcc.dg/pr123109-scalar.c:8:44: warning: right shift count >= width of type
[-Wshift-count-overflow]
gcc.dg/pr123109-scalar.c:8:44: warning: right shift count >= width of type
[-Wshift-count-overflow]
gcc.dg/pr123109-scalar.c: pattern found 0 times
FAIL: gcc.dg/pr123109-scalar.c scan-tree-dump-times optimized ">= 0" 2
gcc.dg/pr123109-scalar.c: pattern found 0 times
FAIL: gcc.dg/pr123109-scalar.c scan-tree-dump-times optimized "< 0" 2
with a similar bogus assumption that int is int32plus.
gcc/testsuite/
PR testsuite/123109
* gcc.dg/pr123109-vector.c (v4si, v4usi): Use SImode elements.
* gcc.dg/pr123109-scalar.c: Use 32-bit integer types.
More information about the Gcc-bugs
mailing list