public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104846] New: [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999
@ 2022-03-08 19:52 gscfq@t-online.de
  2022-03-08 21:52 ` [Bug c++/104846] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2022-03-08 19:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104846
           Summary: [10/11/12 Regression] ICE: tree check: expected
                    function_decl, have field_decl in grokmethod, at
                    cp/decl.cc:17999
           Product: gcc
           Version: 12.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 20190811 and 20190818 :


$ cat z1.cc
struct S { auto operator delete[] () {} };


$ g++-12-20220306 -c z1.cc
z1.cc:1:12: error: non-static data member declared with placeholder 'auto'
    1 | struct S { auto operator delete[] () {} };
      |            ^~~~
z1.cc:1:36: internal compiler error: tree check: expected function_decl, have
field_decl in grokmethod, at cp/decl.cc:17999
    1 | struct S { auto operator delete[] () {} };
      |                                    ^
0x6c7078 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.cc:8688
0x80b3fd tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gcc/tree.h:3450
0x80b3fd grokmethod(cp_decl_specifier_seq*, cp_declarator const*, tree_node*)
        ../../gcc/cp/decl.cc:17999
0x8f2348 cp_parser_save_member_function_body
        ../../gcc/cp/parser.cc:31899
0x93cd44 cp_parser_member_declaration
        ../../gcc/cp/parser.cc:27381
0x9076c2 cp_parser_member_specification_opt
        ../../gcc/cp/parser.cc:26821
0x9076c2 cp_parser_class_specifier_1
        ../../gcc/cp/parser.cc:25887
0x90a4d2 cp_parser_class_specifier
        ../../gcc/cp/parser.cc:26204
0x90a4d2 cp_parser_type_specifier
        ../../gcc/cp/parser.cc:19348
0x90b1e6 cp_parser_decl_specifier_seq
        ../../gcc/cp/parser.cc:15911
0x90be61 cp_parser_simple_declaration
        ../../gcc/cp/parser.cc:15159
0x93e7ee cp_parser_declaration
        ../../gcc/cp/parser.cc:14972
0x93f36d cp_parser_translation_unit
        ../../gcc/cp/parser.cc:5012
0x93f36d c_parse_file()
        ../../gcc/cp/parser.cc:48051
0xacd922 c_common_parse_file()
        ../../gcc/c-family/c-opts.cc:1238

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

* [Bug c++/104846] [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999
  2022-03-08 19:52 [Bug c++/104846] New: [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999 gscfq@t-online.de
@ 2022-03-08 21:52 ` mpolacek at gcc dot gnu.org
  2022-03-09  9:20 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-08 21:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  Started with r10-2475-g777e426772f80c.  It would be trivial to
bring back the grokmethod hunk to fix this ICE, but we should be more helpful
and say that operator delete[] must return type void, which I think
[basic.stc.dynamic.deallocation]#3 says.

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

* [Bug c++/104846] [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999
  2022-03-08 19:52 [Bug c++/104846] New: [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999 gscfq@t-online.de
  2022-03-08 21:52 ` [Bug c++/104846] " mpolacek at gcc dot gnu.org
@ 2022-03-09  9:20 ` rguenth at gcc dot gnu.org
  2022-03-09 15:55 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-09  9:20 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
           Keywords|                            |error-recovery

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

* [Bug c++/104846] [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999
  2022-03-08 19:52 [Bug c++/104846] New: [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999 gscfq@t-online.de
  2022-03-08 21:52 ` [Bug c++/104846] " mpolacek at gcc dot gnu.org
  2022-03-09  9:20 ` rguenth at gcc dot gnu.org
@ 2022-03-09 15:55 ` mpolacek at gcc dot gnu.org
  2022-03-09 16:12 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-09 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #1)
> Confirmed.  Started with r10-2475-g777e426772f80c.  It would be trivial to
> bring back the grokmethod hunk to fix this ICE, but we should be more
> helpful and say that operator delete[] must return type void, which I think
> [basic.stc.dynamic.deallocation]#3 says.

The return type is checked in coerce_delete_type but we never got there in this
test.

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

* [Bug c++/104846] [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999
  2022-03-08 19:52 [Bug c++/104846] New: [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-03-09 15:55 ` mpolacek at gcc dot gnu.org
@ 2022-03-09 16:12 ` mpolacek at gcc dot gnu.org
  2022-03-10 14:32 ` cvs-commit at gcc dot gnu.org
  2022-03-10 14:33 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-09 16:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/104846] [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999
  2022-03-08 19:52 [Bug c++/104846] New: [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-03-09 16:12 ` mpolacek at gcc dot gnu.org
@ 2022-03-10 14:32 ` cvs-commit at gcc dot gnu.org
  2022-03-10 14:33 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-10 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:ac8310dd122172bf9d7217e3367da55f9bf9b21b

commit r12-7599-gac8310dd122172bf9d7217e3367da55f9bf9b21b
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Mar 9 11:23:15 2022 -0500

    c++: ICE with operator delete [PR104846]

    This is an ICE-on-invalid with "auto operator delete[] (void *)" whose
    return type must be void.  The return type is checked in coerce_delete_type
    but we never got there in this test, because we took the wrong path in
    grokdeclarator, set type to error_mark_node, ended up creating a FIELD_DECL
    with build_decl, and confused grokmethod by giving it a FIELD_DECL.

    Fixed by not taking the data member path for a FUNCTION_TYPE.

            PR c++/104846

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Check FUNC_OR_METHOD_TYPE_P before
giving
            data member errors.

    gcc/testsuite/ChangeLog:

            * g++.dg/init/delete5.C: New test.

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

* [Bug c++/104846] [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999
  2022-03-08 19:52 [Bug c++/104846] New: [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-03-10 14:32 ` cvs-commit at gcc dot gnu.org
@ 2022-03-10 14:33 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-10 14:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2022-03-10 14:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 19:52 [Bug c++/104846] New: [10/11/12 Regression] ICE: tree check: expected function_decl, have field_decl in grokmethod, at cp/decl.cc:17999 gscfq@t-online.de
2022-03-08 21:52 ` [Bug c++/104846] " mpolacek at gcc dot gnu.org
2022-03-09  9:20 ` rguenth at gcc dot gnu.org
2022-03-09 15:55 ` mpolacek at gcc dot gnu.org
2022-03-09 16:12 ` mpolacek at gcc dot gnu.org
2022-03-10 14:32 ` cvs-commit at gcc dot gnu.org
2022-03-10 14:33 ` 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).