This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/81598] -fsanitize=enum does not detect range violation
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 03 Aug 2017 11:15:38 +0000
- Subject: [Bug sanitizer/81598] -fsanitize=enum does not detect range violation
- Auto-submitted: auto-generated
- References: <bug-81598-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81598
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
As for the switch, I think there shouldn't be any runtime error, there is no
UB.
You can have default: label even if you list all the possible in-range cases,
you can have enum values in between min/max that aren't in the enumeration, and
you can have case labels outside of the enum range too, that is something for a
warning, but not a runtime error.