https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117398
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Andrew Macleod <amacl...@gcc.gnu.org>: https://gcc.gnu.org/g:78d3156d53567cb2794c3df21dc0d914abe43543 commit r12-10802-g78d3156d53567cb2794c3df21dc0d914abe43543 Author: Andrew MacLeod <amacl...@redhat.com> Date: Mon Nov 4 10:02:35 2024 -0500 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.