The fix for PR middle-end/35800 was to find a "new" default label as one is required by the casesi pattern, but value-range-propagation had determined that a switch statement can't fall through or reach the default label, so "it was NULL". The fix was to arbitrarily use the first label of the case-table. An improvement would be to slice off the last element, shrinking the table and its range. This naturally only affects targets with casesi patterns.
Confirmed.
This is maybe fixed with the patch for PR37285?
Well, at least partially. The range is shifted and the number of values *is* now shrunk by one. Looking at assembly-code for gcc.c-torture/execute/pr35800.c at r140821 reveals that the first case is still arbitrarily taken as the default, where the last one would have been better as it's repeated 32 times. If instead the last value had been picked as the default, duplicate identical values could have been stripped, like in the pr35800.c test-case (there's 32 identical last cases). Ok, I'll open a new one. :)