https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

Kerem Kat <keremkat+gcc at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keremkat+gcc at gmail dot com

--- Comment #3 from Kerem Kat <keremkat+gcc at gmail dot com> ---
This is caused by c_parser_peek_conflict_marker peeking into 4 tokens at once
whereas c_parser_consume_token expects a maximum of 3 tokens to be peeked.

In this case, last token is EOF and it is swallowed by c_parser_consume_token,
leading to ICE within the next c_parser_skip_to_end_of_block_or_statement
invocation which tries to read pfile->buffer that was popped to become empty
via _cpp_pop_buffer.


Minimal test case is six less than signs:

<<<<<<


Full stack trace:

92833-ice.c:1:1: error: expected identifier or ‘(’ before ‘<<’ token
    1 | <<<<<<
      | ^~
92833-ice.c:1:1: internal compiler error: Segmentation fault
0xe150f3 crash_signal
        dir/gcc/toplev.c:328
0x187c684 _cpp_lex_direct
        dir/libcpp/lex.c:2725
0x187c3e4 _cpp_lex_token
        dir/libcpp/lex.c:2608
0x1886d77 cpp_get_token_1
        dir/libcpp/macro.c:2707
0x8ef0e5 c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int)
        dir/gcc/c-family/c-lex.c:458
0x8426b5 c_lex_one_token
        dir/gcc/c/c-parser.c:270
0x842bbe c_parser_peek_token(c_parser*)
        dir/gcc/c/c-parser.c:474
0x843ffd c_parser_skip_to_end_of_block_or_statement
        dir/gcc/c/c-parser.c:1322
0x8455bd c_parser_declaration_or_fndef
        dir/gcc/c/c-parser.c:2123
0x844a1d c_parser_external_declaration
        dir/gcc/c/c-parser.c:1742
0x844566 c_parser_translation_unit
        dir/gcc/c/c-parser.c:1615
0x884ed7 c_parse_file()
        dir/gcc/c/c-parser.c:21704
0x8f9b43 c_common_parse_file()
        dir/gcc/c-family/c-opts.c:1186

Reply via email to