This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/82404] Unnecessary instructions in switch table
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Oct 2017 09:15:00 +0000
- Subject: [Bug middle-end/82404] Unnecessary instructions in switch table
- Auto-submitted: auto-generated
- References: <bug-82404-4@http.gcc.gnu.org/bugzilla/>
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.