public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
@ 2021-07-20 16:52 gscfq@t-online.de
  2021-07-20 16:57 ` [Bug c++/101532] " mpolacek at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gscfq@t-online.de @ 2021-07-20 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101532
           Summary: [12 Regression] ICE in finish_expr_stmt, at
                    cp/semantics.c:859
           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: ---

Changed between 20210704 and 20210711 :


$ cat z1.cc
class A {
  ~A() {}
};
template <class> class B {
  A f = [] {};
};
B<int> c;


$ cat z2.cc
class A {
  ~A() {}
};
template <class T> class B {
  A f = [](T) {};
};
B<int> c;


$ g++-12-20210718 -c z1.cc
z1.cc: In function 'void __static_initialization_and_destruction_0(int, int)':
z1.cc:7:8: internal compiler error: in finish_expr_stmt, at cp/semantics.c:859
    7 | B<int> c;
      |        ^
0x9d659c finish_expr_stmt(tree_node*)
        ../../gcc/cp/semantics.c:859
0x826644 one_static_initialization_or_destruction
        ../../gcc/cp/decl2.c:4118
0x826d56 do_static_initialization_or_destruction
        ../../gcc/cp/decl2.c:4216
0x82d58e c_parse_final_cleanups()
        ../../gcc/cp/decl2.c:5062

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
@ 2021-07-20 16:57 ` mpolacek at gcc dot gnu.org
  2021-07-20 17:00 ` mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-07-20 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |12.0
   Last reconfirmed|                            |2021-07-20

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

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
  2021-07-20 16:57 ` [Bug c++/101532] " mpolacek at gcc dot gnu.org
@ 2021-07-20 17:00 ` mpolacek at gcc dot gnu.org
  2022-01-10 12:13 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-07-20 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r12-2233.

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
  2021-07-20 16:57 ` [Bug c++/101532] " mpolacek at gcc dot gnu.org
  2021-07-20 17:00 ` mpolacek at gcc dot gnu.org
@ 2022-01-10 12:13 ` pinskia at gcc dot gnu.org
  2022-01-20 12:42 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-10 12:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note it is not lambda related at all, here is a (invalid) C++98 case were we
ICE too:
class A {
  ~A() {}
};
template <class> class B {
  A f = 1;
};
B<int> c;

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-01-10 12:13 ` pinskia at gcc dot gnu.org
@ 2022-01-20 12:42 ` rguenth at gcc dot gnu.org
  2022-01-25 20:05 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-20 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-01-20 12:42 ` rguenth at gcc dot gnu.org
@ 2022-01-25 20:05 ` cvs-commit at gcc dot gnu.org
  2022-01-25 20:06 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-25 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:bc90dd0ecf02e11d47d1af7f627e2e2acaa40106

commit r12-6863-gbc90dd0ecf02e11d47d1af7f627e2e2acaa40106
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jan 25 15:04:49 2022 -0500

    c++: deleted fn and noexcept inst [PR101532, PR104225]

    Here when attempting to use B's implicitly deleted default constructor,
    mark_used rightfully returns false, but for the wrong reason: it
    tries to instantiate the synthesized noexcept specifier which then only
    silently fails because get_defaulted_eh_spec suppresses diagnostics
    for deleted functions.  This lack of diagnostics causes us to crash on
    the first testcase below (thanks to the assert in finish_expr_stmt), and
    silently accept the second testcase.

    To fix this, this patch makes mark_used avoid attempting to instantiate
    the noexcept specifier of a deleted function, so that we'll instead
    directly reject (and diagnose) the function due to its deletedness.

            PR c++/101532
            PR c++/104225

    gcc/cp/ChangeLog:

            * decl2.cc (mark_used): Don't consider maybe_instantiate_noexcept
            on a deleted function.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/nsdmi-template21.C: New test.
            * g++.dg/cpp0x/nsdmi-template21a.C: New test.

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-01-25 20:05 ` cvs-commit at gcc dot gnu.org
@ 2022-01-25 20:06 ` ppalka at gcc dot gnu.org
  2022-04-12 23:44 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-25 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2022-01-25 20:06 ` ppalka at gcc dot gnu.org
@ 2022-04-12 23:44 ` cvs-commit at gcc dot gnu.org
  2022-04-12 23:47 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-12 23:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:1429db66619d2b801ac0b586b5eed74ab54a35b0

commit r11-9840-g1429db66619d2b801ac0b586b5eed74ab54a35b0
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jan 25 15:04:49 2022 -0500

    c++: deleted fn and noexcept inst [PR101532, PR104225]

    Here when attempting to use B's implicitly deleted default constructor,
    mark_used rightfully returns false, but for the wrong reason: it
    tries to instantiate the synthesized noexcept specifier which then only
    silently fails because get_defaulted_eh_spec suppresses diagnostics
    for deleted functions.  This lack of diagnostics causes us to crash on
    the first testcase below (thanks to the assert in finish_expr_stmt), and
    silently accept the second testcase.

    To fix this, this patch makes mark_used avoid attempting to instantiate
    the noexcept specifier of a deleted function, so that we'll instead
    directly reject (and diagnose) the function due to its deletedness.

            PR c++/101532
            PR c++/104225

    gcc/cp/ChangeLog:

            * decl2.c (mark_used): Don't consider maybe_instantiate_noexcept
            on a deleted function.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/nsdmi-template21.C: New test.
            * g++.dg/cpp0x/nsdmi-template21a.C: New test.

    (cherry picked from commit bc90dd0ecf02e11d47d1af7f627e2e2acaa40106)

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2022-04-12 23:44 ` cvs-commit at gcc dot gnu.org
@ 2022-04-12 23:47 ` ppalka at gcc dot gnu.org
  2022-05-09 23:32 ` cvs-commit at gcc dot gnu.org
  2022-05-11 14:59 ` cvs-commit at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-04-12 23:47 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.0                        |11.3

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2022-04-12 23:47 ` ppalka at gcc dot gnu.org
@ 2022-05-09 23:32 ` cvs-commit at gcc dot gnu.org
  2022-05-11 14:59 ` cvs-commit at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-09 23:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:ad0398474aff6bb7726e9117711b0a111a4b69e7

commit r10-10602-gad0398474aff6bb7726e9117711b0a111a4b69e7
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jan 25 15:04:49 2022 -0500

    c++: deleted fn and noexcept inst [PR101532, PR104225]

    Here when attempting to use B's implicitly deleted default constructor,
    mark_used rightfully returns false, but for the wrong reason: it
    tries to instantiate the synthesized noexcept specifier which then only
    silently fails because get_defaulted_eh_spec suppresses diagnostics
    for deleted functions.  This lack of diagnostics causes us to crash on
    the first testcase below (thanks to the assert in finish_expr_stmt), and
    silently accept the second testcase.

    To fix this, this patch makes mark_used avoid attempting to instantiate
    the noexcept specifier of a deleted function, so that we'll instead
    directly reject (and diagnose) the function due to its deletedness.

            PR c++/101532
            PR c++/104225

    gcc/cp/ChangeLog:

            * decl2.c (mark_used): Don't consider maybe_instantiate_noexcept
            on a deleted function.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/nsdmi-template21.C: New test.
            * g++.dg/cpp0x/nsdmi-template21a.C: New test.

    (cherry picked from commit bc90dd0ecf02e11d47d1af7f627e2e2acaa40106)

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

* [Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859
  2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2022-05-09 23:32 ` cvs-commit at gcc dot gnu.org
@ 2022-05-11 14:59 ` cvs-commit at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-11 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:4df77364f7fd9ce88c012843fff124346e4d3c06

commit r9-10155-g4df77364f7fd9ce88c012843fff124346e4d3c06
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jan 25 15:04:49 2022 -0500

    c++: deleted fn and noexcept inst [PR101532, PR104225]

    Here when attempting to use B's implicitly deleted default constructor,
    mark_used rightfully returns false, but for the wrong reason: it
    tries to instantiate the synthesized noexcept specifier which then only
    silently fails because get_defaulted_eh_spec suppresses diagnostics
    for deleted functions.  This lack of diagnostics causes us to crash on
    the first testcase below (thanks to the assert in finish_expr_stmt), and
    silently accept the second testcase.

    To fix this, this patch makes mark_used avoid attempting to instantiate
    the noexcept specifier of a deleted function, so that we'll instead
    directly reject (and diagnose) the function due to its deletedness.

            PR c++/101532
            PR c++/104225

    gcc/cp/ChangeLog:

            * decl2.c (mark_used): Don't consider maybe_instantiate_noexcept
            on a deleted function.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/nsdmi-template21.C: New test.
            * g++.dg/cpp0x/nsdmi-template21a.C: New test.

    (cherry picked from commit bc90dd0ecf02e11d47d1af7f627e2e2acaa40106)

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

end of thread, other threads:[~2022-05-11 14:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 16:52 [Bug c++/101532] New: [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859 gscfq@t-online.de
2021-07-20 16:57 ` [Bug c++/101532] " mpolacek at gcc dot gnu.org
2021-07-20 17:00 ` mpolacek at gcc dot gnu.org
2022-01-10 12:13 ` pinskia at gcc dot gnu.org
2022-01-20 12:42 ` rguenth at gcc dot gnu.org
2022-01-25 20:05 ` cvs-commit at gcc dot gnu.org
2022-01-25 20:06 ` ppalka at gcc dot gnu.org
2022-04-12 23:44 ` cvs-commit at gcc dot gnu.org
2022-04-12 23:47 ` ppalka at gcc dot gnu.org
2022-05-09 23:32 ` cvs-commit at gcc dot gnu.org
2022-05-11 14:59 ` cvs-commit 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).