https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97555
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Aldy Hernandez <al...@gcc.gnu.org>: https://gcc.gnu.org/g:2118438f49f0c193abe3fa3def350a8129045746 commit r11-4390-g2118438f49f0c193abe3fa3def350a8129045746 Author: Aldy Hernandez <al...@redhat.com> Date: Mon Oct 26 17:50:37 2020 +0100 Handle signed 1-bit ranges in irange::invert. The problem here is we are trying to add 1 to a -1 in a signed 1-bit field and coming up with UNDEFINED because of the overflow. Signed 1-bits are annoying because you can't really add or subtract one, because the one is unrepresentable. For invert() we have a special subtract_one() function that handles 1-bit signed fields. This patch implements the analogous add_one() function so that invert works. gcc/ChangeLog: PR tree-optimization/97555 * range-op.cc (range_tests): Test 1-bit signed invert. * value-range.cc (subtract_one): Adjust comment. (add_one): New. (irange::invert): Call add_one. gcc/testsuite/ChangeLog: * gcc.dg/pr97555.c: New test.