public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100054] New: internal compiler error: in get_nsdmi
@ 2021-04-12 22:24 barry.revzin at gmail dot com
  2021-04-12 22:50 ` [Bug c++/100054] [11 Regression] " ppalka at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: barry.revzin at gmail dot com @ 2021-04-12 22:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100054
           Summary: internal compiler error: in get_nsdmi
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Reduced with creduce and then by hand:

template <typename n>
struct C {
  void find() {
    struct H {
        C<n> c{};
    };
    (void)[](auto){ return H{}; };
  }
};

void f() {
  C<int>().find();
}

This fails on gcc trunk -std=c++20 (but worked on gcc 10.3, 10.2, 10.1) with
(https://godbolt.org/z/heEKjMn91):

<source>: In instantiation of 'void C<n>::find() [with n = int]':
<source>:12:16:   required from here
<source>:5:14: internal compiler error: in get_nsdmi, at cp/init.c:598
    5 |         C<n> c{};
      |              ^
0x1d01009 internal_error(char const*, ...)
        ???:0
0x6bb009 fancy_abort(char const*, int, char const*)
        ???:0
0x7fa161 get_nsdmi(tree_node*, bool, int)
        ???:0
0x97f2eb finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        ???:0
0x94ae62 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x91699a tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x91d7ef instantiate_decl(tree_node*, bool, bool)
        ???:0
0x95f69b instantiate_pending_templates(int)
        ???:0
0x7cd039 c_parse_final_cleanups()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
ASM generation compiler returned: 1
<source>: In instantiation of 'void C<n>::find() [with n = int]':
<source>:12:16:   required from here
<source>:5:14: internal compiler error: in get_nsdmi, at cp/init.c:598
    5 |         C<n> c{};
      |              ^
0x1d01009 internal_error(char const*, ...)
        ???:0
0x6bb009 fancy_abort(char const*, int, char const*)
        ???:0
0x7fa161 get_nsdmi(tree_node*, bool, int)
        ???:0
0x97f2eb finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        ???:0
0x94ae62 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x91699a tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x91d7ef instantiate_decl(tree_node*, bool, bool)
        ???:0
0x95f69b instantiate_pending_templates(int)
        ???:0
0x7cd039 c_parse_final_cleanups()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Execution build compiler returned: 1

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

* [Bug c++/100054] [11 Regression] internal compiler error: in get_nsdmi
  2021-04-12 22:24 [Bug c++/100054] New: internal compiler error: in get_nsdmi barry.revzin at gmail dot com
@ 2021-04-12 22:50 ` ppalka at gcc dot gnu.org
  2021-04-13  0:53 ` barry.revzin at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-12 22:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-04-12
           Keywords|                            |ice-on-valid-code
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
            Summary|internal compiler error: in |[11 Regression] internal
                   |get_nsdmi                   |compiler error: in
                   |                            |get_nsdmi

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, started with r11-17.

Slightly more reduced testcase:

template <class T>
void f() {
  struct A { T m{}; };
  [](auto){ return A{}; };
}

template void f<int>();

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

* [Bug c++/100054] [11 Regression] internal compiler error: in get_nsdmi
  2021-04-12 22:24 [Bug c++/100054] New: internal compiler error: in get_nsdmi barry.revzin at gmail dot com
  2021-04-12 22:50 ` [Bug c++/100054] [11 Regression] " ppalka at gcc dot gnu.org
@ 2021-04-13  0:53 ` barry.revzin at gmail dot com
  2021-04-13  8:20 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: barry.revzin at gmail dot com @ 2021-04-13  0:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Barry Revzin <barry.revzin at gmail dot com> ---
In case it helps, here's a different example which on trunk ICEs in get_nsdmi,
but on gcc 10.2 and 10.3 ICEs on "unexpected expression '(F)<brace-enclosed
initializer list>()' of kind implicit_conv_expr" (and is accepted by 10.1)

struct F {
private:
  int cx;
};

template <typename>
void find() {
    struct H {
        F o{};
    };
    using r = decltype([](auto) { return H{}; }(0));
}

void p() {
  find<int>();
}

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

* [Bug c++/100054] [11 Regression] internal compiler error: in get_nsdmi
  2021-04-12 22:24 [Bug c++/100054] New: internal compiler error: in get_nsdmi barry.revzin at gmail dot com
  2021-04-12 22:50 ` [Bug c++/100054] [11 Regression] " ppalka at gcc dot gnu.org
  2021-04-13  0:53 ` barry.revzin at gmail dot com
@ 2021-04-13  8:20 ` rguenth at gcc dot gnu.org
  2021-04-13 12:30 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-13  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |11.0
            Version|10.0                        |11.0
      Known to work|                            |10.3.0
           Priority|P3                          |P1

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

* [Bug c++/100054] [11 Regression] internal compiler error: in get_nsdmi
  2021-04-12 22:24 [Bug c++/100054] New: internal compiler error: in get_nsdmi barry.revzin at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-13  8:20 ` rguenth at gcc dot gnu.org
@ 2021-04-13 12:30 ` jason at gcc dot gnu.org
  2021-04-13 18:02 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-13 12:30 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

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

* [Bug c++/100054] [11 Regression] internal compiler error: in get_nsdmi
  2021-04-12 22:24 [Bug c++/100054] New: internal compiler error: in get_nsdmi barry.revzin at gmail dot com
                   ` (3 preceding siblings ...)
  2021-04-13 12:30 ` jason at gcc dot gnu.org
@ 2021-04-13 18:02 ` cvs-commit at gcc dot gnu.org
  2021-04-13 18:06 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-13 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:6173f713a35d5450f0e2acfdaec695b42632aeed

commit r11-8157-g6173f713a35d5450f0e2acfdaec695b42632aeed
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 13 12:33:39 2021 -0400

    c++: generic lambda in template fn with DMI [PR100054]

    get_nsdmi instantiates default member initializers on demand.  It tries to
    push into the context of the class before doing so, so access checking
works
    properly, but since my patch for 90479 not for local classes.  We should
    only be doing this when any template parameters have arguments.  But in
this
    case, we get here while regenerating a generic lambda, so
    processing_template_decl is true, even though the class and its DMI are
    non-dependent at this point.  And so we crashed.  So let's do more of the
    pushing into the context of the class even for local classes.

    gcc/cp/ChangeLog:

            PR c++/100054
            PR c++/90479
            * init.c (get_nsdmi): Do more context adjustment for local classes.

    gcc/testsuite/ChangeLog:

            PR c++/100054
            * g++.dg/cpp1y/lambda-generic-local-class1.C: New test.

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

* [Bug c++/100054] [11 Regression] internal compiler error: in get_nsdmi
  2021-04-12 22:24 [Bug c++/100054] New: internal compiler error: in get_nsdmi barry.revzin at gmail dot com
                   ` (4 preceding siblings ...)
  2021-04-13 18:02 ` cvs-commit at gcc dot gnu.org
@ 2021-04-13 18:06 ` jason at gcc dot gnu.org
  2021-04-13 18:18 ` ppalka at gcc dot gnu.org
  2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-13 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.  Apparently 90479 is the wrong PR number for the earlier change, I
wonder what the correct one was.

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

* [Bug c++/100054] [11 Regression] internal compiler error: in get_nsdmi
  2021-04-12 22:24 [Bug c++/100054] New: internal compiler error: in get_nsdmi barry.revzin at gmail dot com
                   ` (5 preceding siblings ...)
  2021-04-13 18:06 ` jason at gcc dot gnu.org
@ 2021-04-13 18:18 ` ppalka at gcc dot gnu.org
  2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-13 18:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #4)
> Fixed.  Apparently 90479 is the wrong PR number for the earlier change, I
> wonder what the correct one was.

Looks like it's PR90749

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

* [Bug c++/100054] [11 Regression] internal compiler error: in get_nsdmi
  2021-04-12 22:24 [Bug c++/100054] New: internal compiler error: in get_nsdmi barry.revzin at gmail dot com
                   ` (6 preceding siblings ...)
  2021-04-13 18:18 ` ppalka at gcc dot gnu.org
@ 2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-20 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

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

commit r10-9855-gfe0f9ef823dda3205638a2f23d08eb7d0bc497b9
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 13 12:33:39 2021 -0400

    c++: generic lambda in template fn with DMI [PR100054]

    get_nsdmi instantiates default member initializers on demand.  It tries to
    push into the context of the class before doing so, so access checking
works
    properly, but since my patch for 90479 not for local classes.  We should
    only be doing this when any template parameters have arguments.  But in
this
    case, we get here while regenerating a generic lambda, so
    processing_template_decl is true, even though the class and its DMI are
    non-dependent at this point.  And so we crashed.  So let's do more of the
    pushing into the context of the class even for local classes.

    gcc/cp/ChangeLog:

            PR c++/100054
            PR c++/90479
            * init.c (get_nsdmi): Do more context adjustment for local classes.

    gcc/testsuite/ChangeLog:

            PR c++/100054
            * g++.dg/cpp1y/lambda-generic-local-class1.C: New test.

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

end of thread, other threads:[~2021-05-20 21:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 22:24 [Bug c++/100054] New: internal compiler error: in get_nsdmi barry.revzin at gmail dot com
2021-04-12 22:50 ` [Bug c++/100054] [11 Regression] " ppalka at gcc dot gnu.org
2021-04-13  0:53 ` barry.revzin at gmail dot com
2021-04-13  8:20 ` rguenth at gcc dot gnu.org
2021-04-13 12:30 ` jason at gcc dot gnu.org
2021-04-13 18:02 ` cvs-commit at gcc dot gnu.org
2021-04-13 18:06 ` jason at gcc dot gnu.org
2021-04-13 18:18 ` ppalka at gcc dot gnu.org
2021-05-20 21:35 ` 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).