public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106983] New: [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794
@ 2022-09-20 17:31 gscfq@t-online.de
  2022-09-20 18:28 ` [Bug c++/106983] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2022-09-20 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106983
           Summary: [12/13 Regression] ICE tree check: expected class
                    'type', have 'exceptional' (error_mark) in
                    type_build_dtor_call, at cp/class.cc:5794
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20220206 and 20220213 :
(gcc configured with --enable-checking=yes)


$ cat z1.cc
// struct B {int n;};
typedef unsigned long long A;
typedef union
{
  struct B s;
  A a;
} U;
void f (A x, unsigned int b)
{
  const U y = {.a = x};
}


$ g++-13-20220918 -c z1.cc
z1.cc:5:12: error: field 's' has incomplete type 'B'
    5 |   struct B s;
      |            ^
z1.cc:5:10: note: forward declaration of 'struct B'
    5 |   struct B s;
      |          ^
z1.cc: In function 'void f(A, unsigned int)':
z1.cc:10:22: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794
   10 |   const U y = {.a = x};
      |                      ^
0x6fc42b tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc/tree.cc:8877
0x82fed0 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc/tree.h:3643
0x82fed0 type_build_dtor_call(tree_node*)
        ../../gcc/cp/class.cc:5794
0xb49106 split_nonconstant_init_1
        ../../gcc/cp/typeck2.cc:600
0xb4ac4b split_nonconstant_init(tree_node*, tree_node*)
        ../../gcc/cp/typeck2.cc:739
0x8c1c71 check_initializer
        ../../gcc/cp/decl.cc:7453
0x8f0f4a cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/cp/decl.cc:8449
0xa244b3 cp_parser_init_declarator
        ../../gcc/cp/parser.cc:22997
0x9f7d82 cp_parser_simple_declaration
        ../../gcc/cp/parser.cc:15413
0x9f9939 cp_parser_declaration_statement
        ../../gcc/cp/parser.cc:14494
0x9f9feb cp_parser_statement
        ../../gcc/cp/parser.cc:12571
0x9fb114 cp_parser_statement_seq_opt
        ../../gcc/cp/parser.cc:12983
0x9fb1f7 cp_parser_compound_statement
        ../../gcc/cp/parser.cc:12935
0xa231a0 cp_parser_function_body
        ../../gcc/cp/parser.cc:25285
0xa231a0 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.cc:25336
0xa2381a cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.cc:31480
0xa24d5c cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.cc:31397
0xa24d5c cp_parser_init_declarator
        ../../gcc/cp/parser.cc:22735
0x9f7d82 cp_parser_simple_declaration
        ../../gcc/cp/parser.cc:15413
0xa2c49f cp_parser_declaration
        ../../gcc/cp/parser.cc:15099

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

* [Bug c++/106983] [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794
  2022-09-20 17:31 [Bug c++/106983] New: [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794 gscfq@t-online.de
@ 2022-09-20 18:28 ` mpolacek at gcc dot gnu.org
  2022-09-20 18:28 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-09-20 18:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-09-20
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r12-7117-g53cac72cf08212.

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

* [Bug c++/106983] [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794
  2022-09-20 17:31 [Bug c++/106983] New: [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794 gscfq@t-online.de
  2022-09-20 18:28 ` [Bug c++/106983] " mpolacek at gcc dot gnu.org
@ 2022-09-20 18:28 ` mpolacek at gcc dot gnu.org
  2022-09-20 18:31 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-09-20 18:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.4

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

* [Bug c++/106983] [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794
  2022-09-20 17:31 [Bug c++/106983] New: [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794 gscfq@t-online.de
  2022-09-20 18:28 ` [Bug c++/106983] " mpolacek at gcc dot gnu.org
  2022-09-20 18:28 ` mpolacek at gcc dot gnu.org
@ 2022-09-20 18:31 ` pinskia at gcc dot gnu.org
  2022-09-20 18:38 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-09-20 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery
           Severity|normal                      |trivial

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

* [Bug c++/106983] [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794
  2022-09-20 17:31 [Bug c++/106983] New: [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-09-20 18:31 ` pinskia at gcc dot gnu.org
@ 2022-09-20 18:38 ` mpolacek at gcc dot gnu.org
  2022-09-23  0:24 ` cvs-commit at gcc dot gnu.org
  2022-09-23  0:57 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-09-20 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

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 #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think just

--- a/gcc/cp/typeck2.cc
+++ b/gcc/cp/typeck2.cc
@@ -597,7 +597,7 @@ split_nonconstant_init_1 (tree dest, tree init, bool last,
            if (prev == field_index)
              break;
            tree ptype = TREE_TYPE (prev);
-           if (type_build_dtor_call (ptype))
+           if (TYPE_P (ptype) && type_build_dtor_call (ptype))
              {
            tree pcref = build3 (COMPONENT_REF, ptype, dest, prev,
                         NULL_TREE);


should be enough to fix this.

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

* [Bug c++/106983] [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794
  2022-09-20 17:31 [Bug c++/106983] New: [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-09-20 18:38 ` mpolacek at gcc dot gnu.org
@ 2022-09-23  0:24 ` cvs-commit at gcc dot gnu.org
  2022-09-23  0:57 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-23  0:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:8b449dcd84334068c769a2f427812dadb95e61de

commit r13-2803-g8b449dcd84334068c769a2f427812dadb95e61de
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Sep 20 14:54:57 2022 -0400

    c++: ICE-on-invalid with designated initializer [PR106983]

    We ICE in the code added in r12-7117: type_build_dtor_call gets
    the error_mark_node because the type of 'prev' wasn't declared.

            PR c++/106983

    gcc/cp/ChangeLog:

            * typeck2.cc (split_nonconstant_init_1): Check TYPE_P.

    gcc/testsuite/ChangeLog:

            * g++.dg/other/error36.C: New test.

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

* [Bug c++/106983] [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794
  2022-09-20 17:31 [Bug c++/106983] New: [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-09-23  0:24 ` cvs-commit at gcc dot gnu.org
@ 2022-09-23  0:57 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-09-23  0:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-09-23  0:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 17:31 [Bug c++/106983] New: [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in type_build_dtor_call, at cp/class.cc:5794 gscfq@t-online.de
2022-09-20 18:28 ` [Bug c++/106983] " mpolacek at gcc dot gnu.org
2022-09-20 18:28 ` mpolacek at gcc dot gnu.org
2022-09-20 18:31 ` pinskia at gcc dot gnu.org
2022-09-20 18:38 ` mpolacek at gcc dot gnu.org
2022-09-23  0:24 ` cvs-commit at gcc dot gnu.org
2022-09-23  0:57 ` 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).