public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108972] New: ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551
@ 2023-02-28 17:09 asolokha at gmx dot com
  2023-03-01  7:48 ` [Bug c++/108972] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: asolokha at gmx dot com @ 2023-02-28 17:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108972
           Summary: ICE: tree check: expected tree that contains 'decl
                    common' structure, have 'error_mark' in
                    compare_lambda_template_head, at cp/lambda.cc:1551
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, lto
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
                CC: marxin at gcc dot gnu.org, unassigned at gcc dot gnu.org
  Target Milestone: ---

+++ This bug was initially created as a clone of Bug #108971 +++

gcc 13.0.1 20230226 snapshot (g:e6d39f68d03c46637ca6e1bede3d28eae6278df3) ICEs
when compiling the following testcase, reduced from
gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C, w/ -fbranch-probabilities -flto
-fno-inline:

template<typename T>
concept C1 = __is_same_as(T, int);

template<typename T>
concept IsNotTiny = !__is_same_as(T, char);

void
foo ()
{
  auto g = []<C1 T> requires IsNotTiny<T>(T t) -> T
    requires IsNotTiny<decltype(t)> { return t; };

  [](auto t) requires true { return t; }(5);
  [](C1 auto t) { return t; }(5);

  auto a0 = [](IsNotTiny auto a) { return [](auto b){ return b; }; };
  auto a1 = a0(1);
}

% g++-13 -fbranch-probabilities -flto -fno-inline -c sanpvd3f.C
sanpvd3f.C:2:1: error: 'concept' does not name a type; did you mean 'const'?
    2 | concept C1 = __is_same_as(T, int);
      | ^~~~~~~
      | const
sanpvd3f.C:2:1: note: 'concept' only available with '-std=c++20' or
'-fconcepts'
sanpvd3f.C:5:1: error: 'concept' does not name a type; did you mean 'const'?
    5 | concept IsNotTiny = !__is_same_as(T, char);
      | ^~~~~~~
      | const
sanpvd3f.C:5:1: note: 'concept' only available with '-std=c++20' or
'-fconcepts'
sanpvd3f.C: In function 'void foo()':
sanpvd3f.C:10:15: error: 'C1' has not been declared
   10 |   auto g = []<C1 T> requires IsNotTiny<T>(T t) -> T
      |               ^~
sanpvd3f.C:10:21: error: 'requires' only available with '-std=c++20' or
'-fconcepts'
   10 |   auto g = []<C1 T> requires IsNotTiny<T>(T t) -> T
      |                     ^~~~~~~~
sanpvd3f.C:10:30: error: 'IsNotTiny' was not declared in this scope
   10 |   auto g = []<C1 T> requires IsNotTiny<T>(T t) -> T
      |                              ^~~~~~~~~
sanpvd3f.C:10:40: error: 'T' was not declared in this scope
   10 |   auto g = []<C1 T> requires IsNotTiny<T>(T t) -> T
      |                                        ^
sanpvd3f.C:10:43: error: 'T' was not declared in this scope
   10 |   auto g = []<C1 T> requires IsNotTiny<T>(T t) -> T
      |                                           ^
sanpvd3f.C:10:44: error: expected ')' before 't'
   10 |   auto g = []<C1 T> requires IsNotTiny<T>(T t) -> T
      |                                          ~ ^~
      |                                            )
sanpvd3f.C: In lambda function:
sanpvd3f.C:11:50: error: expected '{' before ';' token
   11 |     requires IsNotTiny<decltype(t)> { return t; };
      |                                                  ^
sanpvd3f.C: In function 'void foo()':
sanpvd3f.C:13:14: error: 'requires' only available with '-std=c++20' or
'-fconcepts'
   13 |   [](auto t) requires true { return t; }(5);
      |              ^~~~~~~~
sanpvd3f.C:13:23: internal compiler error: tree check: expected tree that
contains 'decl common' structure, have 'error_mark' in
compare_lambda_template_head, at cp/lambda.cc:1551
   13 |   [](auto t) requires true { return t; }(5);
      |                       ^~~~
0x896ef7 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/tree.cc:9083
0x70171c contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/tree.h:3644
0x70171c compare_lambda_template_head
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/lambda.cc:1551
0xa6a86c compare_lambda_sig
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/lambda.cc:1598
0xa6a86c record_lambda_scope_sig_discriminator(tree_node*, tree_node*)
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/lambda.cc:1656
0xb234b8 cp_parser_lambda_declarator_opt
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:11774
0xb05f86 cp_parser_lambda_expression
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:11142
0xb06d63 cp_parser_primary_expression
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:5826
0xb095e6 cp_parser_postfix_expression
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:7777
0xaf1454 cp_parser_binary_expression
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:10147
0xaf2332 cp_parser_assignment_expression
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:10490
0xaf4784 cp_parser_expression
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:10660
0xaf88b7 cp_parser_expression_statement
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:12804
0xb041db cp_parser_statement
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:12584
0xb0530d cp_parser_statement_seq_opt
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:12955
0xb053d7 cp_parser_compound_statement
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:12907
0xb28b54 cp_parser_function_body
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:25323
0xb28b54 cp_parser_ctor_initializer_opt_and_function_body
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:25374
0xb2ac00 cp_parser_function_definition_after_declarator
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:31995
0xb2c152 cp_parser_function_definition_from_specifiers_and_declarator
       
/var/tmp/portage/sys-devel/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/cp/parser.cc:31912

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

* [Bug c++/108972] ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551
  2023-02-28 17:09 [Bug c++/108972] New: ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 asolokha at gmx dot com
@ 2023-03-01  7:48 ` rguenth at gcc dot gnu.org
  2023-03-02 15:24 ` [Bug c++/108972] ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 since r13-3601-g2b0e81d5cc2f7e1d marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-01  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-03-01
           Keywords|lto                         |error-recovery
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Happens without any options as well.

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

* [Bug c++/108972] ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 since r13-3601-g2b0e81d5cc2f7e1d
  2023-02-28 17:09 [Bug c++/108972] New: ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 asolokha at gmx dot com
  2023-03-01  7:48 ` [Bug c++/108972] " rguenth at gcc dot gnu.org
@ 2023-03-02 15:24 ` marxin at gcc dot gnu.org
  2023-03-09 22:06 ` [Bug c++/108972] [13 Regression] " jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-03-02 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at gcc dot gnu.org
            Summary|ICE: tree check: expected   |ICE: tree check: expected
                   |tree that contains 'decl    |tree that contains 'decl
                   |common' structure, have     |common' structure, have
                   |'error_mark' in             |'error_mark' in
                   |compare_lambda_template_hea |compare_lambda_template_hea
                   |d, at cp/lambda.cc:1551     |d, at cp/lambda.cc:1551
                   |                            |since
                   |                            |r13-3601-g2b0e81d5cc2f7e1d

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Likely started with r13-3601-g2b0e81d5cc2f7e1d.

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

* [Bug c++/108972] [13 Regression] ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 since r13-3601-g2b0e81d5cc2f7e1d
  2023-02-28 17:09 [Bug c++/108972] New: ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 asolokha at gmx dot com
  2023-03-01  7:48 ` [Bug c++/108972] " rguenth at gcc dot gnu.org
  2023-03-02 15:24 ` [Bug c++/108972] ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 since r13-3601-g2b0e81d5cc2f7e1d marxin at gcc dot gnu.org
@ 2023-03-09 22:06 ` jason at gcc dot gnu.org
  2023-03-10 18:49 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-09 22:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/108972] [13 Regression] ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 since r13-3601-g2b0e81d5cc2f7e1d
  2023-02-28 17:09 [Bug c++/108972] New: ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2023-03-09 22:06 ` [Bug c++/108972] [13 Regression] " jason at gcc dot gnu.org
@ 2023-03-10 18:49 ` cvs-commit at gcc dot gnu.org
  2023-03-10 18:50 ` jason at gcc dot gnu.org
  2023-03-14 15:19 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-10 18:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r13-6594-ga915c29a7d63ccb88cfded75ba1c8c4919845e98
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Mar 9 17:01:48 2023 -0500

    c++: constrained lambda error-recovery [PR108972]

    Better not to ICE after various valid errors.

            PR c++/108972

    gcc/cp/ChangeLog:

            * lambda.cc (compare_lambda_template_head): Check more
            for error_mark_node.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-lambda3.C: Run at lower std levels,
            but expect errors.

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

* [Bug c++/108972] [13 Regression] ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 since r13-3601-g2b0e81d5cc2f7e1d
  2023-02-28 17:09 [Bug c++/108972] New: ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2023-03-10 18:49 ` cvs-commit at gcc dot gnu.org
@ 2023-03-10 18:50 ` jason at gcc dot gnu.org
  2023-03-14 15:19 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-10 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

* [Bug c++/108972] [13 Regression] ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 since r13-3601-g2b0e81d5cc2f7e1d
  2023-02-28 17:09 [Bug c++/108972] New: ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2023-03-10 18:50 ` jason at gcc dot gnu.org
@ 2023-03-14 15:19 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-14 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:7f22d1c83e74c41116300bebac2e4c492c90b03d

commit r13-6664-g7f22d1c83e74c41116300bebac2e4c492c90b03d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 14 16:18:47 2023 +0100

    testsuite: Fix up g++.dg/cpp2a/concepts-lambda3.C [PR108972]

    On Fri, Mar 10, 2023 at 01:49:38PM -0500, Jason Merrill via Gcc-patches
wrote:
    > gcc/testsuite/ChangeLog:
    >
    >       * g++.dg/cpp2a/concepts-lambda3.C: Run at lower std levels,
    >       but expect errors.

    I'm seeing
    +UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++11 compilation failed
to produce executable
    +UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++14 compilation failed
to produce executable
    +UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++17 compilation failed
to produce executable
    +UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++98 compilation failed
to produce executable
    with this change, and if I test with
    GXX_TESTSUITE_STDS=98,11,14,17,20,2b make check-g++ -k
RUNTESTFLAGS="--target_board=unix\{-m32,-m64,-m64/-fconcepts\}
dg.exp=concepts-lambda3.C"
    I see even FAILs for the -fconcepts case, so apparently even -std=c++17
    -fconcepts isn't enough to make it compile without errors.

    The following patch will expect errors for all of c++17_down and will
    make the test dg-do compile for that case too, such that the UNRESOLVED
    stuff is gone.

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

            PR c++/108972
            PR testsuite/109129
            * g++.dg/cpp2a/concepts-lambda3.C: Use dg-do run only for c++20,
            for c++17_down dg-do compile.  Expect dg-excess-errors for
c++17_down
            rather than ! concepts.

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

end of thread, other threads:[~2023-03-14 15:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 17:09 [Bug c++/108972] New: ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 asolokha at gmx dot com
2023-03-01  7:48 ` [Bug c++/108972] " rguenth at gcc dot gnu.org
2023-03-02 15:24 ` [Bug c++/108972] ICE: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in compare_lambda_template_head, at cp/lambda.cc:1551 since r13-3601-g2b0e81d5cc2f7e1d marxin at gcc dot gnu.org
2023-03-09 22:06 ` [Bug c++/108972] [13 Regression] " jason at gcc dot gnu.org
2023-03-10 18:49 ` cvs-commit at gcc dot gnu.org
2023-03-10 18:50 ` jason at gcc dot gnu.org
2023-03-14 15:19 ` 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).