https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107029
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:cb8f25c5dc9f6d5207c826c2dafe25f68458ceaf commit r13-2891-gcb8f25c5dc9f6d5207c826c2dafe25f68458ceaf Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Sep 27 08:26:18 2022 +0200 reassoc: Handle OFFSET_TYPE like POINTER_TYPE in optimize_range_tests_cmp_bitwise [PR107029[ As the testcase shows, OFFSET_TYPE needs the same treatment as POINTER_TYPE/REFERENCE_TYPE, otherwise we fail the same during the newly added verification. OFFSET_TYPE is signed though, so unlike POINTER_TYPE/REFERENCE_TYPE it can also trigger with the x < 0 && y < 0 && z < 0 to (x | y | z) < 0 optimization. 2022-09-27 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/107029 * tree-ssa-reassoc.cc (optimize_range_tests_cmp_bitwise): Treat OFFSET_TYPE like POINTER_TYPE, except that OFFSET_TYPE may be signed and so can trigger even the (b % 4) == 3 case. * g++.dg/torture/pr107029.C: New test.