https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71265
Bug ID: 71265 Summary: gcc ICE on x86_64-linux-gnu with “seg fault” Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: helloqirun at gmail dot com Target Milestone: --- The following invalid code causes an ICE when compiled with the current gcc trunk on x86_64-linux-gnu in both 32-bit and 64-bit modes. This piece of code is syntactically valid since it can be parsed by an ANSI C parser. It crashes every release of gcc since gcc-3.4 (I did not have earlier versions installed on my machine). $ gcc-3.4 abc.c abc.c: In function `ID': abc.c:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-3.4/README.Bugs>. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 7.0.0 20160524 (experimental) [trunk revision 236651] (GCC) $ gcc-trunk abc.c abc.c:1:8: warning: return type defaults to ‘int’ [-Wimplicit-int] extern ID ( ID ) extern ID [ __func__ ] ; { } ^~ In function ‘ID’: cc1: internal compiler error: Segmentation fault 0xbac48f crash_signal ../../gcc/gcc/toplev.c:333 0x652fb3 bind ../../gcc/gcc/c/c-decl.c:718 0x666ce8 c_make_fname_decl ../../gcc/gcc/c/c-decl.c:3996 0x6e89a1 fname_decl(unsigned int, unsigned int, tree_node*) ../../gcc/gcc/c-family/c-common.c:1006 0x6ab2cb c_parser_postfix_expression ../../gcc/gcc/c/c-parser.c:7627 0x6ad68a c_parser_unary_expression ../../gcc/gcc/c/c-parser.c:6939 0x6ae487 c_parser_cast_expression ../../gcc/gcc/c/c-parser.c:6768 0x6ae6a2 c_parser_binary_expression ../../gcc/gcc/c/c-parser.c:6577 0x6af385 c_parser_conditional_expression ../../gcc/gcc/c/c-parser.c:6348 0x6afa20 c_parser_expr_no_commas ../../gcc/gcc/c/c-parser.c:6265 0x6c404e c_parser_direct_declarator_inner ../../gcc/gcc/c/c-parser.c:3567 0x6c7370 c_parser_declaration_or_fndef ../../gcc/gcc/c/c-parser.c:1816 0x6c7f78 c_parser_declaration_or_fndef ../../gcc/gcc/c/c-parser.c:2094 0x6d37bd c_parser_external_declaration ../../gcc/gcc/c/c-parser.c:1549 0x6d41e9 c_parser_translation_unit ../../gcc/gcc/c/c-parser.c:1430 0x6d41e9 c_parse_file() ../../gcc/gcc/c/c-parser.c:17914 0x736a12 c_common_parse_file() ../../gcc/gcc/c-family/c-opts.c:1064 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. $ cat abc.c extern ID ( ID ) extern ID [ __func__ ] ; { }