https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123212
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Summary|GCC 15 no longer compiles |[15/16 Regression] GCC 15
|switch statements to jump |no longer compiles switch
|tables by default with Og |statements to jump tables
| |by default with Og
CC| |pheeck at gcc dot gnu.org
Target Milestone|--- |15.3
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2025-12-19
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
switch conversion would have chosen a load from a constant initializer, not a
jump table. Instead it's switch lowering that turns the switch into a binary
tree.
I wonder why we chose that for the dense case. At least at -O0 expanding
to a jump table feels more natural (it's also smaller by a small margin
at -O0, but larger by a larger margin at -Og, so ...).
int example(int num) {
switch(num) {
case 0: return 3420;
case 1: return 1304123;
case 2: return 2139;
case 3: return 13;
case 4: return 320;
case 5: return 134123;
case 6: return 239;
case 7: return 1;
}
return 0;
}