https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66264
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- enum Foo { A,B,C,D }; int square(Foo f) { switch (f) { case A: return 33; case B: return 24; case C: return 857; case D: return 980; //default: return 0; }; //return 0; // uncomment this to get the fast code } Just in case the goo.gl link goes away.