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

            Bug ID: 104647
           Summary: [9/10/11/12 Regression] ICE in
                    get_or_insert_ctor_field, at cp/constexpr.cc:3705
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

Seems to have started between 20181104 and 20181111 :
(gcc configured with --enable-checking=yes)


$ cat z1.cc
struct A { int i; int f(); };
typedef int A::*MemPtr;
typedef int (A::*MemFuncPtr)();
struct B { MemPtr a[3]; MemFuncPtr b[3]; };
template <B> struct X {};
template <typename T>
typedef X<B{{}, { MemFuncPtr{ nullptr }}}> XB;


$ cat z2.cc
struct A { int i; int f(); };
typedef int A::*MemPtr;
typedef int (A::*MemFuncPtr)();
struct B { MemPtr a[3]; MemFuncPtr b[3]; };
template <B> struct X {};
template <typename T>
typedef X<B{{}, { MemFuncPtr{ 0 }}}> XB;


$ cat za1.cc
struct A typedef *MemPtr;
typedef (A::*MemFuncPtr) ();
struct B { int *b; MemFuncPtr c; };
template <B<B{{}, MemFuncPtr {nullptr}};


$ g++-12-20220220 -c z1.cc -std=c++20   # or -std=c++2a
z1.cc:7:41: internal compiler error: Segmentation fault
    7 | typedef X<B{{}, { MemFuncPtr{ nullptr }}}> XB;
      |                                         ^
0x10ca74f crash_signal
        ../../gcc/toplev.cc:322
0x76d8b2 get_or_insert_ctor_field
        ../../gcc/cp/constexpr.cc:3705
0x784b33 cxx_eval_bare_aggregate
        ../../gcc/cp/constexpr.cc:4825
0x774b40 cxx_eval_constant_expression
        ../../gcc/cp/constexpr.cc:7110
0x779ec3 cxx_eval_outermost_constant_expr
        ../../gcc/cp/constexpr.cc:7706
0x77f270 fold_non_dependent_expr_template
        ../../gcc/cp/constexpr.cc:8065
0x77f7a4 fold_non_dependent_init(tree_node*, int, bool, tree_node*)
        ../../gcc/cp/constexpr.cc:8143
0xa59638 massage_init_elt
        ../../gcc/cp/typeck2.cc:1437
0xa599d4 process_init_constructor_array
        ../../gcc/cp/typeck2.cc:1502
0xa57c9a process_init_constructor
        ../../gcc/cp/typeck2.cc:1917
0xa57c9a digest_init_r
        ../../gcc/cp/typeck2.cc:1325
0xa59627 massage_init_elt
        ../../gcc/cp/typeck2.cc:1434
0xa5811b process_init_constructor_record
        ../../gcc/cp/typeck2.cc:1651
0xa5811b process_init_constructor
        ../../gcc/cp/typeck2.cc:1920
0xa5811b digest_init_r
        ../../gcc/cp/typeck2.cc:1325
0x9ddc3e finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        ../../gcc/cp/semantics.cc:3220
0x8fd33b cp_parser_functional_cast
        ../../gcc/cp/parser.cc:31832
0x91195d cp_parser_postfix_expression
        ../../gcc/cp/parser.cc:7578
0x928a01 cp_parser_unary_expression
        ../../gcc/cp/parser.cc:9035
0x8f63df cp_parser_cast_expression
        ../../gcc/cp/parser.cc:9939

Reply via email to