public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074
@ 2022-12-15  2:05 m101010a at gmail dot com
  2022-12-15  2:07 ` [Bug c++/108116] " m101010a at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: m101010a at gmail dot com @ 2022-12-15  2:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108116
           Summary: internal compiler error: in check_noexcept_r, at
                    cp/except.cc:1074
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m101010a at gmail dot com
  Target Milestone: ---

When compiling the code

#include <initializer_list>
struct c {
  c(int);
  ~c();
};
struct d {
  d(std::initializer_list<c>);
};
struct e {
  d f{0};
};
template <typename> void h() {
  e{};
}

GCC 12 fails with an internal compiler error.  This happens with GCC 12.1,
12.2, and when built off of the recent git commit
f17ddf2c484427e6ddfd994b62fefcdac27ac02f.  It does not happen with GCC 11.3 or
before.  The full error details and preprocessed source are in the attachment.

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

* [Bug c++/108116] internal compiler error: in check_noexcept_r, at cp/except.cc:1074
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
@ 2022-12-15  2:07 ` m101010a at gmail dot com
  2022-12-15 10:48 ` [Bug c++/108116] [12/13 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2 marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: m101010a at gmail dot com @ 2022-12-15  2:07 UTC (permalink / raw)
  To: gcc-bugs

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

m101010a at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #54098|0                           |1
        is obsolete|                            |

--- Comment #1 from m101010a at gmail dot com ---
Created attachment 54099
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54099&action=edit
Bug report produced by -freport-bug

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

* [Bug c++/108116] [12/13 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
  2022-12-15  2:07 ` [Bug c++/108116] " m101010a at gmail dot com
@ 2022-12-15 10:48 ` marxin at gcc dot gnu.org
  2022-12-15 10:50 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-15 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|internal compiler error: in |[12/13 Regression] ICE in
                   |check_noexcept_r, at        |check_noexcept_r, at
                   |cp/except.cc:1074           |cp/except.cc:1074 since
                   |                            |r12-6897-gdec8d0e5fa00ceb2
             Status|UNCONFIRMED                 |NEW
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-12-15

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-6897-gdec8d0e5fa00ceb2.

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

* [Bug c++/108116] [12/13 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
  2022-12-15  2:07 ` [Bug c++/108116] " m101010a at gmail dot com
  2022-12-15 10:48 ` [Bug c++/108116] [12/13 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2 marxin at gcc dot gnu.org
@ 2022-12-15 10:50 ` marxin at gcc dot gnu.org
  2022-12-15 22:27 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-15 10:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

namespace std {
template <class> struct initializer_list {
  int *_M_array;
  unsigned long _M_len;
};
struct c {
  c(int);
  ~c();
};
struct d {
  d(initializer_list<c>);
};
struct e {
  d f{0};
};
template <typename> void h() {
  e {};
};
}

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

* [Bug c++/108116] [12/13 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
                   ` (2 preceding siblings ...)
  2022-12-15 10:50 ` marxin at gcc dot gnu.org
@ 2022-12-15 22:27 ` pinskia at gcc dot gnu.org
  2022-12-20 19:57 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-15 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.3

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

* [Bug c++/108116] [12/13 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
                   ` (3 preceding siblings ...)
  2022-12-15 22:27 ` pinskia at gcc dot gnu.org
@ 2022-12-20 19:57 ` ppalka at gcc dot gnu.org
  2022-12-21 12:42 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-20 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/108116] [12/13 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
                   ` (4 preceding siblings ...)
  2022-12-20 19:57 ` ppalka at gcc dot gnu.org
@ 2022-12-21 12:42 ` rguenth at gcc dot gnu.org
  2022-12-23 16:18 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-21 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/108116] [12/13 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
                   ` (5 preceding siblings ...)
  2022-12-21 12:42 ` rguenth at gcc dot gnu.org
@ 2022-12-23 16:18 ` cvs-commit at gcc dot gnu.org
  2022-12-23 16:18 ` [Bug c++/108116] [12 " 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-12-23 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r13-4879-gcf59c8983ef6590f0d69014f8dc8778b5b7691c6
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Dec 23 11:17:45 2022 -0500

    c++: get_nsdmi in template context [PR108116]

    Here during ahead of time checking of C{}, we indirectly call get_nsdmi
    for C::m from finish_compound_literal, which in turn calls
    break_out_target_exprs for C::m's (non-templated) initializer, during
    which we build a call to A::~A and check expr_noexcept_p for it (from
    build_vec_delete_1).  But this is all done with processing_template_decl
    set, so the built A::~A call is templated (whose form was recently
    changed by r12-6897-gdec8d0e5fa00ceb2) which expr_noexcept_p doesn't
    expect, and we crash.

    This patch fixes this by clearing processing_template_decl before
    the call to break_out_target_exprs from get_nsdmi.  And since it more
    generally seems we shouldn't be seeing (or producing) non-templated
    trees in break_out_target_exprs, this patch also adds an assert to
    that effect.

            PR c++/108116

    gcc/cp/ChangeLog:

            * constexpr.cc (maybe_constant_value): Clear
            processing_template_decl before calling break_out_target_exprs.
            * init.cc (get_nsdmi): Likewise.
            * tree.cc (break_out_target_exprs): Assert processing_template_decl
            is cleared.

    gcc/testsuite/ChangeLog:

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

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

* [Bug c++/108116] [12 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
                   ` (6 preceding siblings ...)
  2022-12-23 16:18 ` cvs-commit at gcc dot gnu.org
@ 2022-12-23 16:18 ` ppalka at gcc dot gnu.org
  2023-03-07  2:18 ` cvs-commit at gcc dot gnu.org
  2023-03-07  2:23 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-23 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |13.0
            Summary|[12/13 Regression] ICE in   |[12 Regression] ICE in
                   |check_noexcept_r, at        |check_noexcept_r, at
                   |cp/except.cc:1074 since     |cp/except.cc:1074 since
                   |r12-6897-gdec8d0e5fa00ceb2  |r12-6897-gdec8d0e5fa00ceb2

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

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

* [Bug c++/108116] [12 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
                   ` (7 preceding siblings ...)
  2022-12-23 16:18 ` [Bug c++/108116] [12 " ppalka at gcc dot gnu.org
@ 2023-03-07  2:18 ` cvs-commit at gcc dot gnu.org
  2023-03-07  2:23 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-07  2:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:09c5937d8295fbc96f6d05cc12ec3709740a277d

commit r12-9230-g09c5937d8295fbc96f6d05cc12ec3709740a277d
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Dec 23 11:17:45 2022 -0500

    c++: get_nsdmi in template context [PR108116]

    Here during ahead of time checking of C{}, we indirectly call get_nsdmi
    for C::m from finish_compound_literal, which in turn calls
    break_out_target_exprs for C::m's (non-templated) initializer, during
    which we build a call to A::~A and check expr_noexcept_p for it (from
    build_vec_delete_1).  But this is all done with processing_template_decl
    set, so the built A::~A call is templated (whose form was recently
    changed by r12-6897-gdec8d0e5fa00ceb2) which expr_noexcept_p doesn't
    expect, and we crash.

    This patch fixes this by clearing processing_template_decl before
    the call to break_out_target_exprs from get_nsdmi.  And since it more
    generally seems we shouldn't be seeing (or producing) non-templated
    trees in break_out_target_exprs, this patch also adds an assert to
    that effect.

            PR c++/108116

    gcc/cp/ChangeLog:

            * constexpr.cc (maybe_constant_value): Clear
            processing_template_decl before calling break_out_target_exprs.
            * init.cc (get_nsdmi): Likewise.
            * tree.cc (break_out_target_exprs): Assert processing_template_decl
            is cleared.

    gcc/testsuite/ChangeLog:

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

    (cherry picked from commit cf59c8983ef6590f0d69014f8dc8778b5b7691c6)

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

* [Bug c++/108116] [12 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2
  2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
                   ` (8 preceding siblings ...)
  2023-03-07  2:18 ` cvs-commit at gcc dot gnu.org
@ 2023-03-07  2:23 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-07  2:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12.3 and 13, thanks for the bug report.

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

end of thread, other threads:[~2023-03-07  2:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15  2:05 [Bug c++/108116] New: internal compiler error: in check_noexcept_r, at cp/except.cc:1074 m101010a at gmail dot com
2022-12-15  2:07 ` [Bug c++/108116] " m101010a at gmail dot com
2022-12-15 10:48 ` [Bug c++/108116] [12/13 Regression] ICE in check_noexcept_r, at cp/except.cc:1074 since r12-6897-gdec8d0e5fa00ceb2 marxin at gcc dot gnu.org
2022-12-15 10:50 ` marxin at gcc dot gnu.org
2022-12-15 22:27 ` pinskia at gcc dot gnu.org
2022-12-20 19:57 ` ppalka at gcc dot gnu.org
2022-12-21 12:42 ` rguenth at gcc dot gnu.org
2022-12-23 16:18 ` cvs-commit at gcc dot gnu.org
2022-12-23 16:18 ` [Bug c++/108116] [12 " ppalka at gcc dot gnu.org
2023-03-07  2:18 ` cvs-commit at gcc dot gnu.org
2023-03-07  2:23 ` ppalka 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).