https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120277
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Andrew Macleod <amacl...@gcc.gnu.org>: https://gcc.gnu.org/g:4291071a6aa3b50800ad5fc70b5fb83cb9398237 commit r16-661-g4291071a6aa3b50800ad5fc70b5fb83cb9398237 Author: Andrew MacLeod <amacl...@redhat.com> Date: Thu May 15 11:06:05 2025 -0400 Check for casts becoming UNDEFINED. In various situations a cast that is ultimately unreahcable may produce an UNDEFINED result, and we can't check the bounds in this case. PR tree-optimization/120277 gcc/ * range-op-ptr.cc (operator_cast::fold_range): Check if the cast if UNDEFINED before setting bounds. gcc/testsuite/ * gcc.dg/pr120277.c: New.