https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71853
Bug ID: 71853 Summary: [6/7 regression] ICE on an ill-formed case statement in c_do_switch_warnings Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- Prior to GCC 6.1, GCC rejected the invalid code below with xyz.c:3:12: error: expected ‘:’ or ‘...’ before ‘{’ token Since r225116 committed in the GCC 6.0 development cycle GCC fails on it with an ICE: $ cat xyz.c && /build/gcc-trunk-git/gcc/xgcc -B /build/gcc-trunk-git/gcc -S -Wall -Wextra -Wpedantic xyz.c void f (void) { case (0) { switch 0: { } } } xyz.c: In function ‘f’: xyz.c:3:12: error: expected ‘:’ or ‘...’ before ‘{’ token case (0) { ^ xyz.c:4:12: error: expected ‘(’ before numeric constant switch 0: { } ^ xyz.c:4:12: warning: statement with no effect [-Wunused-value] xyz.c:5:3: internal compiler error: Segmentation fault } ^ 0xe96dee crash_signal /src/gcc/trunk/gcc/toplev.c:335 0x87b066 c_do_switch_warnings(splay_tree_s*, unsigned int, tree_node*, tree_node*, bool, bool) /src/gcc/trunk/gcc/c-family/c-common.c:6296 0x7f2b64 c_finish_case(tree_node*, tree_node*) /src/gcc/trunk/gcc/c/c-typeck.c:10042 0x812c23 c_parser_switch_statement /src/gcc/trunk/gcc/c/c-parser.c:5612 0x811a35 c_parser_statement_after_labels /src/gcc/trunk/gcc/c/c-parser.c:5144 0x81149b c_parser_compound_statement_nostart /src/gcc/trunk/gcc/c/c-parser.c:4861 0x810e8c c_parser_compound_statement /src/gcc/trunk/gcc/c/c-parser.c:4696 0x8119cb c_parser_statement_after_labels /src/gcc/trunk/gcc/c/c-parser.c:5135 0x81149b c_parser_compound_statement_nostart /src/gcc/trunk/gcc/c/c-parser.c:4861 0x810e8c c_parser_compound_statement /src/gcc/trunk/gcc/c/c-parser.c:4696 0x80ba9c c_parser_declaration_or_fndef /src/gcc/trunk/gcc/c/c-parser.c:2105 0x80a54e c_parser_external_declaration /src/gcc/trunk/gcc/c/c-parser.c:1549 0x80a0a5 c_parser_translation_unit /src/gcc/trunk/gcc/c/c-parser.c:1430 0x83c491 c_parse_file() /src/gcc/trunk/gcc/c/c-parser.c:17930 0x8aef11 c_common_parse_file() /src/gcc/trunk/gcc/c-family/c-opts.c:1070 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.