public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "haoxintu at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-96328-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2020-07-27  3:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27  3:42 haoxintu at gmail dot com [this message]
2020-07-27  6:44 ` [Bug c++/96328] [11 Regression] Single keyword "friend" makes GCC ICE in cp_lexer_previous_token, at cp/parser.c:769 since r11-891-g1dc83b460653c29f marxin at gcc dot gnu.org
2020-07-27  7:44 ` rguenth at gcc dot gnu.org
2020-07-27  9:06 ` mark at gcc dot gnu.org
2020-07-27  9:09 ` jakub at gcc dot gnu.org
2020-07-27  9:26 ` mark at gcc dot gnu.org
2020-07-27  9:52 ` jakub at gcc dot gnu.org
2020-07-27 10:55 ` mark at gcc dot gnu.org
2020-07-28 13:42 ` cvs-commit at gcc dot gnu.org
2020-07-28 13:46 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96328-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).