This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/82404] Unnecessary instructions in switch table


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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Clang's transformation is not based on the valid values of the enumeration, but
the fact that there's a missing return statement, so if you call it with an
argument that isn't one of the cases it's UB. The compiler can assume that
never happens, so can add an implicit __builtin_unreachable() after the switch.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]