public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713
@ 2023-01-30 20:08 gscfq@t-online.de
  2023-01-30 20:13 ` [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gscfq@t-online.de @ 2023-01-30 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108606
           Summary: [13 Regression] ICE in
                    potential_constant_expression_1, at
                    cp/constexpr.cc:9713
           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 20220925 and 20221009 :


$ cat z1.cc
void f() {
  g([&](auto x) {
    class C {
      friend void h();
    };
  }
}


$ g++-13-20230129 -c z1.cc
z1.cc: In lambda function:
z1.cc:6:3: internal compiler error: in potential_constant_expression_1, at
cp/constexpr.cc:9713
    6 |   }
      |   ^
0x7efa5b potential_constant_expression_1
        ../../gcc/cp/constexpr.cc:9712
0x7ee09a potential_constant_expression_1
        ../../gcc/cp/constexpr.cc:9281
0x7eeb5e potential_constant_expression_1
        ../../gcc/cp/constexpr.cc:9303
0x7ee09a potential_constant_expression_1
        ../../gcc/cp/constexpr.cc:9281
0x7ee09a potential_constant_expression_1
        ../../gcc/cp/constexpr.cc:9281
0x7efdda potential_constant_expression_1(tree_node*, bool, bool, bool, bool,
int)
        ../../gcc/cp/constexpr.cc:10027
0x83868c finish_function(bool)
        ../../gcc/cp/decl.cc:18200
0x8666e4 finish_lambda_function(tree_node*)
        ../../gcc/cp/lambda.cc:1807
0x8e5df9 cp_parser_lambda_body
        ../../gcc/cp/parser.cc:11827
0x8e5df9 cp_parser_lambda_expression
        ../../gcc/cp/parser.cc:11148
0x8e5df9 cp_parser_primary_expression
        ../../gcc/cp/parser.cc:5826
0x8e9056 cp_parser_postfix_expression
        ../../gcc/cp/parser.cc:7777
0x8fc5df cp_parser_unary_expression
        ../../gcc/cp/parser.cc:9141
0x8d118f cp_parser_cast_expression
        ../../gcc/cp/parser.cc:10045
0x8d1a4f cp_parser_binary_expression
        ../../gcc/cp/parser.cc:10147
0x8d2454 cp_parser_assignment_expression
        ../../gcc/cp/parser.cc:10490
0x8d63bf cp_parser_parenthesized_expression_list_elt
        ../../gcc/cp/parser.cc:8110
0x8d6885 cp_parser_parenthesized_expression_list
        ../../gcc/cp/parser.cc:8579
0x8e88e0 cp_parser_postfix_expression
        ../../gcc/cp/parser.cc:7854
0x8fc5df cp_parser_unary_expression
        ../../gcc/cp/parser.cc:9141

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

* [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
  2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
@ 2023-01-30 20:13 ` pinskia at gcc dot gnu.org
  2023-01-30 20:13 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-30 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[13 Regression] ICE in      |[13 Regression] ICE in
                   |potential_constant_expressi |potential_constant_expressi
                   |on_1, at                    |on_1 with friend function
                   |cp/constexpr.cc:9713        |declaration inside a local
                   |                            |class of a
                   |                            |generic/templated lambda

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
auto t = 
  [](int) {
    class C {
      friend void h();
    };
  };

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

* [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
  2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
  2023-01-30 20:13 ` [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda pinskia at gcc dot gnu.org
@ 2023-01-30 20:13 ` pinskia at gcc dot gnu.org
  2023-01-31 15:22 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-30 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

* [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
  2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
  2023-01-30 20:13 ` [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda pinskia at gcc dot gnu.org
  2023-01-30 20:13 ` pinskia at gcc dot gnu.org
@ 2023-01-31 15:22 ` mpolacek at gcc dot gnu.org
  2023-01-31 15:25 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-01-31 15:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-01-31

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The reduced test in Comment 1 doesn't ICE for me but the original test does.

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

* [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
  2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-01-31 15:22 ` mpolacek at gcc dot gnu.org
@ 2023-01-31 15:25 ` mpolacek at gcc dot gnu.org
  2023-02-21 12:51 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-01-31 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r13-2965-g73d9b0e5947e16.

commit 73d9b0e5947e162386f7e25d3851097cee1bb366
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Sep 20 17:12:29 2022 -0400

    c++: check DECL_INITIAL for constexpr

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

* [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
  2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-01-31 15:25 ` mpolacek at gcc dot gnu.org
@ 2023-02-21 12:51 ` rguenth at gcc dot gnu.org
  2023-02-21 13:25 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-21 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
  2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-02-21 12:51 ` rguenth at gcc dot gnu.org
@ 2023-02-21 13:25 ` jakub at gcc dot gnu.org
  2023-02-21 13:48 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-02-21 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Adjusted #c0 testcase that is accepted up to r13-2164 and ICEs with r13-2165 up
to current trunk:

template <typename T>
void bar (T) {}

void
foo ()
{
  bar ([&](auto x) { class C { friend void baz (); }; });
}

I can confirm #c1 doesn't reproduce for me either.

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

* [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
  2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-02-21 13:25 ` jakub at gcc dot gnu.org
@ 2023-02-21 13:48 ` jakub at gcc dot gnu.org
  2023-03-01  9:25 ` cvs-commit at gcc dot gnu.org
  2023-03-01  9:28 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-02-21 13:48 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54500
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54500&action=edit
gcc13-pr108606.patch

Untested fix - conditional reversion of the second hunk of the commit for
non-VAR_DECLs.

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

* [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
  2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2023-02-21 13:48 ` jakub at gcc dot gnu.org
@ 2023-03-01  9:25 ` cvs-commit at gcc dot gnu.org
  2023-03-01  9:28 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-01  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r13-6387-gb222e725f53231a0bd9799ca93892a79d592a5f3
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 1 10:22:59 2023 +0100

    c++: Don't recurse on DECL_INITIAL for DECL_EXPR on non-VAR_DECLs
[PR108606]

    The r13-2965-g73d9b0e5947e16 change changed the line touched in this patch
    from
          return RECUR (tmp, want_rval);
    to
          return RECUR (DECL_INITIAL (tmp), want_rval);
    This is on DECL_EXPR handling code, where tmp can be lots of different
    trees and DECL_INITIAL unfortunately also means different things on
    different trees.
    It is the initializer on VAR_DECL, DECL_ARG_TYPE on PARM_DECLs (though
    those are unlikely to have DECL_EXPRs), for FUNCTION_DECLs the body,
    ..., USING_DECL_DECLS on USING_DECLs and DECL_FRIENDLIST on TYPE_DECLs.

    The testcase below ICEs because we have a DECL_EXPR for TYPE_DECL
    which has non-NULL DECL_FRIENDLIST and we certainly can't recurse on
    the friend list.

    The following patch will RECUR on DECL_INITIAL only for VAR_DECLs and
    for anything else just return true.

    2023-03-01  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108606
            * constexpr.cc (potential_constant_expression_1) <case DECL_EXPR>:
            Only recurse on DECL_INITIAL (tmp) if tmp is a VAR_DECL, otherwise
            just return true.

            * g++.dg/cpp1y/pr108606.C: New test.

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

* [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda
  2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2023-03-01  9:25 ` cvs-commit at gcc dot gnu.org
@ 2023-03-01  9:28 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-01  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-03-01  9:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 20:08 [Bug c++/108606] New: [13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:9713 gscfq@t-online.de
2023-01-30 20:13 ` [Bug c++/108606] [13 Regression] ICE in potential_constant_expression_1 with friend function declaration inside a local class of a generic/templated lambda pinskia at gcc dot gnu.org
2023-01-30 20:13 ` pinskia at gcc dot gnu.org
2023-01-31 15:22 ` mpolacek at gcc dot gnu.org
2023-01-31 15:25 ` mpolacek at gcc dot gnu.org
2023-02-21 12:51 ` rguenth at gcc dot gnu.org
2023-02-21 13:25 ` jakub at gcc dot gnu.org
2023-02-21 13:48 ` jakub at gcc dot gnu.org
2023-03-01  9:25 ` cvs-commit at gcc dot gnu.org
2023-03-01  9:28 ` jakub 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).