[Bug c++/96328] New: Singe keyword "friend" makes GCC ICE in cp_lexer_previous_token, at cp/parser.c:769
haoxintu at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jul 27 03:42:08 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96328
Bug ID: 96328
Summary: Singe keyword "friend" makes GCC ICE in
cp_lexer_previous_token, at cp/parser.c:769
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: error-recovery, ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
Hi, all.
Weirdly, a single "friend" makes GCC crashed in the current trunk.
Input:
//small.cc
friend
Command:
g++ small.cc
Output:
small.cc:1:1: error: ‘friend’ used outside of class
1 | friend
| ^~~~~~
| ------
small.cc:2: internal compiler error: in cp_lexer_previous_token, at
cp/parser.c:769
0x66759d cp_lexer_previous_token
../../gcc/cp/parser.c:769
0x667c28 cp_lexer_previous_token
../../gcc/tree.h:3303
0x667c28 cp_parser_error_1
../../gcc/cp/parser.c:2943
0x9e04c0 cp_parser_error
../../gcc/cp/parser.c:3003
0x9e04c0 cp_parser_error
../../gcc/cp/parser.c:3000
0x9e04c0 cp_parser_unqualified_id
../../gcc/cp/parser.c:6332
0x9d7cf8 cp_parser_direct_declarator
../../gcc/cp/parser.c:22255
0x9d7cf8 cp_parser_declarator
../../gcc/cp/parser.c:21137
0x9ed1a6 cp_parser_init_declarator
../../gcc/cp/parser.c:20637
0x9cdacc cp_parser_simple_declaration
../../gcc/cp/parser.c:13799
0x9f8d2e cp_parser_declaration
../../gcc/cp/parser.c:13498
0x9f941b cp_parser_translation_unit
../../gcc/cp/parser.c:4781
0x9f941b c_parse_file()
../../gcc/cp/parser.c:44069
0xb13e2d c_common_parse_file()
../../gcc/c-family/c-opts.c:1188
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/tuhaoxin/compilers/gcc-0726/build/bin/../libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure CC=gcc-10 CXX=g++-10
--prefix=/home/hatuhaoxin/compilers/gcc-0726/build/ --enable-languages=c,c++
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200726 (experimental) (GCC)
Interestingly, this case only occurred in the 20200726 trunk version, it does
not crash on 20200725.
Thanks,
Haoxin
More information about the Gcc-bugs
mailing list