https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87857
Bug ID: 87857 Summary: case label does not reduce to an integer constant Product: gcc Version: 7.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: stsp at users dot sourceforge.net Target Milestone: --- Hello. The following example: --- #include <stdint.h> int foo(uint64_t a) { switch (a) { case (1 << 31): return 1; } return 0; } int main(int argc, char *argv[]) { return foo(argc); } --- doesn't compile with -fsanitize=undefined: --- $ gcc -Wall -fsanitize=undefined lswitch.c lswitch.c: In function ‘foo’: lswitch.c:6:5: error: case label does not reduce to an integer constant case (1 << 31): --- But if you use g++ or clang with the same switches, then it compiles fine.