This is only an issue on GCC versions prior to 4.4, this was fixed in GCC 4.5.
Is it possible to tell the compiler the variable used in a switch fits within the provided
I didn't try, but I'm not sure that gcc_unreachable
does the same thing as __builtin_unreachable
. Googling the two, gcc_unreachable
appears to be designed as a as an assertion tool for development of GCC itself, perhaps with a branch prediction hint included, whereas __builtin_unreachable
makes the program instantly undefined — which sounds like deleting the basic block, which is what you want.
http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-g_t_005f_005fbuiltin_005funreachable-3075