public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95935] New: ICE : Segmentation fault
@ 2020-06-27  5:45 haoxintu at gmail dot com
  2020-07-07 23:45 ` [Bug c++/95935] ICE : Segmentation fault crash_signal from toplev.c:328 mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-27  5:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95935
           Summary: ICE : Segmentation fault
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: 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: ---

This code, bug.cc, reduced by C-Reduce, makes GCC-trunk ICE with Segmentation
fault.

$cat bug.cc
enum struct a;
template <class = enum struct a { b; 
template <> enum struct a {

$g++ bug.cc
bug.cc:2:36: error: expected ‘}’ before ‘;’ token
    2 | template <class = enum struct a { b;
      |                                 ~  ^
bug.cc:2:36: error: expected ‘>’ before ‘;’ token
bug.cc:2:36: error: expected unqualified-id before ‘;’ token
bug.cc:4: error: expected identifier at end of input
bug.cc:4: error: expected ‘}’ at end of input
bug.cc:3:27: note: to match this ‘{’
    3 | template <> enum struct a {
      |                           ^
bug.cc:2:35: internal compiler error: Segmentation fault
    2 | template <class = enum struct a { b;
      |                                   ^
0xfe451f crash_signal
        ../../gcc/toplev.c:328
0x1295faa copy_node(tree_node*)
        ../../gcc/tree.c:1186
0x9121bc finish_enum_value_list(tree_node*)
        ../../gcc/cp/decl.c:15712
0x9a20f4 cp_parser_enum_specifier
        ../../gcc/cp/parser.c:19443
0x9a20f4 cp_parser_type_specifier
        ../../gcc/cp/parser.c:17734
0x9a2a02 cp_parser_decl_specifier_seq
        ../../gcc/cp/parser.c:14410
0x9c8f35 cp_parser_single_declaration
        ../../gcc/cp/parser.c:29459
0x9ca0f0 cp_parser_explicit_specialization
        ../../gcc/cp/parser.c:17654
0x9ccac9 cp_parser_declaration
        ../../gcc/cp/parser.c:13430
0x9cd06a cp_parser_translation_unit
        ../../gcc/cp/parser.c:4761
0x9cd06a c_parse_file()
        ../../gcc/cp/parser.c:44043
0xae4dbb c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1190
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++ --version
g++ (GCC) 11.0.0 20200626 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/95935] ICE : Segmentation fault crash_signal from toplev.c:328
  2020-06-27  5:45 [Bug c++/95935] New: ICE : Segmentation fault haoxintu at gmail dot com
@ 2020-07-07 23:45 ` mpolacek at gcc dot gnu.org
  2020-07-07 23:53 ` mpolacek at gcc dot gnu.org
  2020-07-08 12:08 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-07 23:45 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|error-recovery              |accepts-invalid
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-07-07

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, but here's an improved test:

enum class E;
template <typename T = enum class E { a }> struct X { }; 
template<> enum class E { };

ICEs without giving any previous errors, and 

template <typename T = enum class E { a }> struct X { };

is accepts-invalid.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/95935] ICE : Segmentation fault crash_signal from toplev.c:328
  2020-06-27  5:45 [Bug c++/95935] New: ICE : Segmentation fault haoxintu at gmail dot com
  2020-07-07 23:45 ` [Bug c++/95935] ICE : Segmentation fault crash_signal from toplev.c:328 mpolacek at gcc dot gnu.org
@ 2020-07-07 23:53 ` mpolacek at gcc dot gnu.org
  2020-07-08 12:08 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-07 23:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Doesn't have to be scoped enum:

template<typename = enum E { }> struct X { };

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/95935] ICE : Segmentation fault crash_signal from toplev.c:328
  2020-06-27  5:45 [Bug c++/95935] New: ICE : Segmentation fault haoxintu at gmail dot com
  2020-07-07 23:45 ` [Bug c++/95935] ICE : Segmentation fault crash_signal from toplev.c:328 mpolacek at gcc dot gnu.org
  2020-07-07 23:53 ` mpolacek at gcc dot gnu.org
@ 2020-07-08 12:08 ` mpolacek at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-08 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
If we want to fix this generally, we'll have to introduce the notion of
defining-type-specifier, introduced in CWG 2141, to the parser.  (Also see CWG
686.)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-08 12:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27  5:45 [Bug c++/95935] New: ICE : Segmentation fault haoxintu at gmail dot com
2020-07-07 23:45 ` [Bug c++/95935] ICE : Segmentation fault crash_signal from toplev.c:328 mpolacek at gcc dot gnu.org
2020-07-07 23:53 ` mpolacek at gcc dot gnu.org
2020-07-08 12:08 ` mpolacek at gcc dot gnu.org

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).