public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96441] New: ICE in tree check: expected integer_cst, have cond_expr in get_len, at tree.h:5954
@ 2020-08-03 17:03 haoxintu at gmail dot com
  2020-08-03 19:28 ` [Bug c++/96441] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: haoxintu at gmail dot com @ 2020-08-03 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96441
           Summary: ICE in tree check: expected integer_cst, have
                    cond_expr in get_len, at tree.h:5954
           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.

This code, reduced by C-Vise, makes GCC-trunk ICE and makes released GCC
versions "confused by early errors".

Input:
//small.cc
enum struct a : int;
template <typename = enum class a { b = 0 ? : throw}> class A {};
template <> enum struct a {c};


Command:
g++ small.cc

Output:
small.cc:2:47: error: expression ‘<throw-expression>’ is not a constant
expression
    2 | template <typename = enum class a { b = 0 ? : throw}> class A {};
      |                                               ^~~~~
small.cc:3:28: internal compiler error: tree check: expected integer_cst, have
cond_expr in get_len, at tree.h:5954
    3 | template <> enum struct a {c};
      |                            ^
0x7c7fd7 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.c:9687
0x616fed tree_check(tree_node const*, char const*, int, char const*, tree_code)
        ../../gcc/tree.h:3559
0x616fed wi::extended_tree<192>::get_len() const
        ../../gcc/tree.h:5954
0x616fed wi::int_traits<generic_wide_int<wi::extended_tree<192> >
>::decompose(long*, unsigned int, generic_wide_int<wi::extended_tree<192> >
const&)
        ../../gcc/wide-int.h:985
0x616fed wide_int_ref_storage<true,
false>::wide_int_ref_storage<generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&, unsigned int)
        ../../gcc/wide-int.h:1034
0x616fed generic_wide_int<wide_int_ref_storage<true, false>
>::generic_wide_int<generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&, unsigned int)
        ../../gcc/wide-int.h:790
0x616fed wi::binary_traits<generic_wide_int<wi::extended_tree<192> >, int,
wi::int_traits<generic_wide_int<wi::extended_tree<192> > >::precision_type,
wi::int_traits<int>::precision_type>::result_type
wi::add<generic_wide_int<wi::extended_tree<192> >,
int>(generic_wide_int<wi::extended_tree<192> > const&, int const&, signop,
wi::overflow_type*)
        ../../gcc/wide-int.h:2467
0x616fed build_enumerator(tree_node*, tree_node*, tree_node*, tree_node*,
unsigned int)
        ../../gcc/cp/decl.c:15857
0x9aafec cp_parser_enumerator_definition
        ../../gcc/cp/parser.c:19585
0x9aafec cp_parser_enumerator_list
        ../../gcc/cp/parser.c:19514
0x9aafec cp_parser_enum_specifier
        ../../gcc/cp/parser.c:19444
0x9aafec cp_parser_type_specifier
        ../../gcc/cp/parser.c:17769
0x9ab50e cp_parser_decl_specifier_seq
        ../../gcc/cp/parser.c:14436
0x9d2fe5 cp_parser_single_declaration
        ../../gcc/cp/parser.c:29499
0x9d4300 cp_parser_explicit_specialization
        ../../gcc/cp/parser.c:17689
0x9d776d cp_parser_declaration
        ../../gcc/cp/parser.c:13456
0x9d7d2b cp_parser_translation_unit
        ../../gcc/cp/parser.c:4793
0x9d7d2b c_parse_file()
        ../../gcc/cp/parser.c:44081
0xaf2e9d 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.

My gcc version is
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/haoxin/corpus-compilers/gcc-trunk/gcc-master/build/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
--prefix=/home/haoxin/corpus-compilers/gcc-trunk/gcc-master/build/
--enable-languages=c,c++ CC=gcc CXX=g++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200801 (experimental) (GCC) 

Thanks,
Haoxin

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

* [Bug c++/96441] ICE in tree check: expected integer_cst, have cond_expr in get_len, at tree.h:5954
  2020-08-03 17:03 [Bug c++/96441] New: ICE in tree check: expected integer_cst, have cond_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
@ 2020-08-03 19:28 ` mpolacek at gcc dot gnu.org
  2021-10-27 22:43 ` arthur.j.odwyer at gmail dot com
  2021-10-31  3:24 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-03 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-08-03
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/96441] ICE in tree check: expected integer_cst, have cond_expr in get_len, at tree.h:5954
  2020-08-03 17:03 [Bug c++/96441] New: ICE in tree check: expected integer_cst, have cond_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
  2020-08-03 19:28 ` [Bug c++/96441] " mpolacek at gcc dot gnu.org
@ 2021-10-27 22:43 ` arthur.j.odwyer at gmail dot com
  2021-10-31  3:24 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2021-10-27 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arthur.j.odwyer at gmail dot com

--- Comment #2 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> ---
Still there in trunk. Here's a very slightly reduced version:

// https://godbolt.org/z/8arT4Gn6P
enum a : int;
template<class = enum a : int {b}>;
template<> enum a : int {c};

====

<source>:2:35: error: expected unqualified-id before ';' token
    2 | template<class = enum a : int {b}>;
      |                                   ^
<source>:3:26: internal compiler error: Segmentation fault
    3 | template<> enum a : int {c};
      |                          ^
0x20037b9 internal_error(char const*, ...)
        ???:0
0x8c7150 build_enumerator(tree_node*, tree_node*, tree_node*, tree_node*,
unsigned int)
        ???:0
0xa0bea5 c_parse_file()
        ???:0
0xb92e22 c_common_parse_file()
        ???:0
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.

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

* [Bug c++/96441] ICE in tree check: expected integer_cst, have cond_expr in get_len, at tree.h:5954
  2020-08-03 17:03 [Bug c++/96441] New: ICE in tree check: expected integer_cst, have cond_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
  2020-08-03 19:28 ` [Bug c++/96441] " mpolacek at gcc dot gnu.org
  2021-10-27 22:43 ` arthur.j.odwyer at gmail dot com
@ 2021-10-31  3:24 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-31  3:24 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |trivial

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

end of thread, other threads:[~2021-10-31  3:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 17:03 [Bug c++/96441] New: ICE in tree check: expected integer_cst, have cond_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
2020-08-03 19:28 ` [Bug c++/96441] " mpolacek at gcc dot gnu.org
2021-10-27 22:43 ` arthur.j.odwyer at gmail dot com
2021-10-31  3:24 ` pinskia 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).