From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 607783858D38; Mon, 27 Jul 2020 03:42:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 607783858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1595821328; bh=0xS/JreSajc4wjlN3N+EojC2U7GoXBRTzloPSfyP5lw=; h=From:To:Subject:Date:From; b=ny5izf9Y8XeVYYMjTnLDGl4bxTmMm9Q9GDjalymFiEEPRJnp9wmlIJbbGDrWSYYYi QLfNrrsQ3RYx6+6GXJoZ+x6RM6Gxp+5mV9f1AA2EqwtfVNSFW3D+96D3evi6Y0E6vR sOyvQwDDG+yFRJN0zU74EgF8ZBvDazmERKHX7dBk= From: "haoxintu at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96328] New: Singe keyword "friend" makes GCC ICE in cp_lexer_previous_token, at cp/parser.c:769 Date: Mon, 27 Jul 2020 03:42:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: error-recovery, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: haoxintu at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2020 03:42:08 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96328 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:=20 //small.cc friend Command: g++ small.cc Output: small.cc:1:1: error: =E2=80=98friend=E2=80=99 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 for instructions. $g++ -v Using built-in specs. COLLECT_GCC=3Dg++ COLLECT_LTO_WRAPPER=3D/home/tuhaoxin/compilers/gcc-0726/build/bin/../libexe= c/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure CC=3Dgcc-10 CXX=3Dg++-10 --prefix=3D/home/hatuhaoxin/compilers/gcc-0726/build/ --enable-languages=3D= c,c++ --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.0 20200726 (experimental) (GCC)=20 Interestingly, this case only occurred in the 20200726 trunk version, it do= es not crash on 20200725. Thanks, Haoxin=