https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117398
--- Comment #5 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:766075c47db5cc9d04463bfb2219b593bb4263ee commit r15-4887-g766075c47db5cc9d04463bfb2219b593bb4263ee Author: Andrew MacLeod <amacl...@redhat.com> Date: Sat Nov 2 10:26:24 2024 -0400 Don't call invert on VARYING. When all cases go to one label and resul in a VARYING value, we can't invert that value to remove all values from the default case. Simply check for this case and set the default to UNDEFINED. PR tree-optimization/117398 gcc/ * gimple-range-edge.cc (gimple_outgoing_range::calc_switch_ranges): Check for VARYING and don't call invert () on it. gcc/testsuite/ * gcc.dg/pr117398.c: New.