https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79472

--- Comment #4 from Yuri Kunde Schlesner <yuriks at yuriks dot net> ---
Note that, while this particular example uses a noreturn call, the same pattern
applies to any switch where the default case is the only one which has code
that can't be transformed into a table. For example, replacing `abort();` with
`s = external_getstr();` (`const char* external_getstr();`) follows the same
pattern in all compilers (gcc 6.3 can optimize to table with the nullptr hack,
clang can always optimize, gcc 7 can't optimize at all).

Another thing I noticed is that gcc 6.3 still leaves in the nullptr check after
the switch, even though it's actually unreachable at that point. (Probably out
of scope for this bug though.)

Reply via email to