public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94829] New: ICE in poplevel, at cp/decl.c:585
@ 2020-04-28 17:52 asolokha at gmx dot com
  2020-04-29  7:22 ` [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: asolokha at gmx dot com @ 2020-04-28 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94829
           Summary: ICE in poplevel, at cp/decl.c:585
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

Created attachment 48395
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48395&action=edit
Testcase

g++-10.0.1-alpha20200426 snapshot (g:29f55115583a0dab6cbac749c4f0804fd88e9536)
ICEs when compiling the attached testcase w/ -fcoroutines:

% g++-10.0.1 -fcoroutines -c clang/test/CodeGenCoroutines/coro-lambda.cpp
clang/test/CodeGenCoroutines/coro-lambda.cpp: In instantiation of 'auto
SyncAwait(_AwrT&&) [with _AwrT = suspend_always&]':
clang/test/CodeGenCoroutines/coro-lambda.cpp:50:17:   required from here
clang/test/CodeGenCoroutines/coro-lambda.cpp:41:20: error: coroutines require a
traits template; cannot find 'std::coroutine_traits'
   41 |       try { (void)(co_await A); } catch (...) {}
      |                   ~^~~~~~~~~~~
clang/test/CodeGenCoroutines/coro-lambda.cpp:41:20: note: perhaps '#include
<coroutine>' is missing
clang/test/CodeGenCoroutines/coro-lambda.cpp:43:26: internal compiler error: in
poplevel, at cp/decl.c:585
   43 |     Task t = AwaitAsync();
      |                          ^
0x6138a0 poplevel(int, int, int)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/decl.c:585
0xa2ecab do_poplevel(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/semantics.c:453
0xa329d9 finish_compound_stmt(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/semantics.c:1542
0x9f38c0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:18145
0x9f3f7b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:18109
0x9f1312 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:17821
0x9f1662 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:18140
0x9ee76a instantiate_decl(tree_node*, bool, bool)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:25688
0x91fbda maybe_instantiate_decl
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/decl2.c:5370
0x922418 maybe_instantiate_decl
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/tree.h:3402
0x922418 mark_used(tree_node*, int)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/decl2.c:5577
0x875e72 build_over_call
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/call.c:9048
0x87800c build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/call.c:4599
0xa36734 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/semantics.c:2672
0x9ad191 cp_parser_postfix_expression
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:7468
0x98eb69 cp_parser_binary_expression
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:9557
0x99081e cp_parser_assignment_expression
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:9862
0x990be3 cp_parser_expression
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:10030
0x993c38 cp_parser_expression_statement
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:11691
0x99f253 cp_parser_statement
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:11487

The testcase is unmodified test/CodeGenCoroutines/coro-lambda.cpp from the
clang 10.0.0 testsuite. clang++ 9.0.1 accepts it. I don't really see much
opportunities for reduction here.

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

* [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff
  2020-04-28 17:52 [Bug c++/94829] New: ICE in poplevel, at cp/decl.c:585 asolokha at gmx dot com
@ 2020-04-29  7:22 ` marxin at gcc dot gnu.org
  2020-04-29 10:56 ` iains at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-29  7:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-29
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
   Target Milestone|---                         |10.0
             Status|UNCONFIRMED                 |NEW
            Summary|ICE in poplevel, at         |ICE in poplevel, at
                   |cp/decl.c:585               |cp/decl.c:585 since
                   |                            |r10-6063-g49789fd08378e3ff
      Known to fail|                            |10.0

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-6063-g49789fd08378e3ff.

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

* [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff
  2020-04-28 17:52 [Bug c++/94829] New: ICE in poplevel, at cp/decl.c:585 asolokha at gmx dot com
  2020-04-29  7:22 ` [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff marxin at gcc dot gnu.org
@ 2020-04-29 10:56 ` iains at gcc dot gnu.org
  2020-05-07 11:56 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2020-04-29 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
patch posted here:
https://gcc.gnu.org/pipermail/gcc-patches/2020-April/544843.html
we are very close to branching for 10, so not sure if this will be included in
10.1

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

* [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff
  2020-04-28 17:52 [Bug c++/94829] New: ICE in poplevel, at cp/decl.c:585 asolokha at gmx dot com
  2020-04-29  7:22 ` [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff marxin at gcc dot gnu.org
  2020-04-29 10:56 ` iains at gcc dot gnu.org
@ 2020-05-07 11:56 ` jakub at gcc dot gnu.org
  2020-05-07 20:07 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-05-07 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.0                        |10.2

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.1 has been released.

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

* [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff
  2020-04-28 17:52 [Bug c++/94829] New: ICE in poplevel, at cp/decl.c:585 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2020-05-07 11:56 ` jakub at gcc dot gnu.org
@ 2020-05-07 20:07 ` cvs-commit at gcc dot gnu.org
  2020-06-06 16:51 ` cvs-commit at gcc dot gnu.org
  2020-06-06 18:42 ` iains at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-07 20:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

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

commit r11-178-gc7100843831147a034fe37d231c54ac53ceace45
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Thu May 7 19:48:31 2020 +0100

    coroutines: Improve error recovery [PR94817, PR94829].

    When we have completely missing key information (e.g. the
    coroutine_traits) or a partially transformed function body, we
    need to try and balance returning useful information about
    failures with the possibility that some part of the diagnostics
    machinery or following code will not be able to handle the
    state.

    The PRs (and revised testcase) point to cases where that processing
    has failed.

    This revises the process to avoid special handling for the
    ramp, and falls back on the same code used for regular function
    fails.

    There are test-cases (in addition to the ones for the PRs) that now
    cover all early exit points [where the transforms are considered
    to have failed in a manner that does not allow compilation to
    continue].

    gcc/cp/ChangeLog:

    2020-05-07  Iain Sandoe  <iain@sandoe.co.uk>

            PR c++/94817
            PR c++/94829
            * coroutines.cc (morph_fn_to_coro): Set unformed outline
            functions to error_mark_node.  For early error returns suppress
            warnings about missing ramp return values.  Fix reinstatement
            of the function body on pre-existing initial error.
            * decl.c (finish_function): Use the normal error path for fails
            in the ramp function, do not try to compile the helpers if the
            transform fails.

    gcc/testsuite/ChangeLog:

    2020-05-07  Iain Sandoe  <iain@sandoe.co.uk>

            PR c++/94817
            PR c++/94829
            * g++.dg/coroutines/coro-missing-final-suspend.C: New test.
            * g++.dg/coroutines/coro-missing-initial-suspend.C: New test.
            * g++.dg/coroutines/coro-missing-promise-yield.C: Check for
            continuation of compilation.
            * g++.dg/coroutines/coro-missing-promise.C: Likewise.
            * g++.dg/coroutines/coro-missing-ret-value.C: Likewise
            * g++.dg/coroutines/coro-missing-ret-void.C: Likewise
            * g++.dg/coroutines/coro-missing-ueh-3.C: Likewise
            * g++.dg/coroutines/pr94817.C: New test.
            * g++.dg/coroutines/pr94829.C: New test.

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

* [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff
  2020-04-28 17:52 [Bug c++/94829] New: ICE in poplevel, at cp/decl.c:585 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2020-05-07 20:07 ` cvs-commit at gcc dot gnu.org
@ 2020-06-06 16:51 ` cvs-commit at gcc dot gnu.org
  2020-06-06 18:42 ` iains at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-06 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Iain D Sandoe
<iains@gcc.gnu.org>:

https://gcc.gnu.org/g:03da87235697eab344cde609d81d3f405f450c42

commit r10-8259-g03da87235697eab344cde609d81d3f405f450c42
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Jun 6 09:48:31 2020 +0100

    coroutines: Improve error recovery [PR94817, PR94829, PR95087].

    When we have completely missing key information (e.g. the
    coroutine_traits) or a partially transformed function body, we
    need to try and balance returning useful information about
    failures with the possibility that some part of the diagnostics
    machinery or following code will not be able to handle the
    state.

    The PRs (and revised testcase) point to cases where that processing
    has failed.

    This revises the process to avoid special handling for the
    ramp, and falls back on the same code used for regular function
    fails.

    There are test-cases (in addition to the ones for the PRs) that now
    cover all early exit points [where the transforms are considered
    to have failed in a manner that does not allow compilation to
    continue].

    Diagnosing bad uses of 'return' in coroutines is somewhat
    tricky, since the user can use the keyword before we know
    that the function is a coroutine (where such returns are not
    permitted).  At present, we are just doing a check for any
    use of 'return' and erroring on that.  However, we can't then
    pass the function body on, since it will contain unlowered
    coroutine trees.

    This avoids the issue by dropping the entire function body
    under that circumstance.

            Backport c7100843831147a034fe37d231c54ac53ceace45 and
a1bb808504643e6c3c0df0fdd68a941ed2a64c7f0

    gcc/cp/ChangeLog:

            PR c++/94817
            PR c++/94829
            PR c++/95087
            * coroutines.cc (morph_fn_to_coro): Set unformed outline
            functions to error_mark_node.  For early error returns suppress
            warnings about missing ramp return values.  Fix reinstatement
            of the function body on pre-existing initial error.  If we see
            an early fatal error, drop the erroneous function body.
            * decl.c (finish_function): Use the normal error path for fails
            in the ramp function, do not try to compile the helpers if the
            transform fails.

    gcc/testsuite/ChangeLog:

            PR c++/94817
            PR c++/94829
            PR c++/95087
            * g++.dg/coroutines/coro-missing-final-suspend.C: New test.
            * g++.dg/coroutines/coro-missing-initial-suspend.C: New test.
            * g++.dg/coroutines/coro-missing-promise-yield.C: Check for
            continuation of compilation.
            * g++.dg/coroutines/coro-missing-promise.C: Likewise.
            * g++.dg/coroutines/coro-missing-ret-value.C: Likewise
            * g++.dg/coroutines/coro-missing-ret-void.C: Likewise
            * g++.dg/coroutines/coro-missing-ueh-3.C: Likewise
            * g++.dg/coroutines/pr94817.C: New test.
            * g++.dg/coroutines/pr94829.C: New test.
            * g++.dg/coroutines/co-return-syntax-08-bad-return.C:
            Adjust the testcase to do the compile (rather than an
            -fsyntax-only parse).
            * g++.dg/coroutines/coro1-ret-int-yield-int.h
            (MISSING_INITIAL_SUSPEND, MISSING_FINAL_SUSPEND): New.

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

* [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff
  2020-04-28 17:52 [Bug c++/94829] New: ICE in poplevel, at cp/decl.c:585 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2020-06-06 16:51 ` cvs-commit at gcc dot gnu.org
@ 2020-06-06 18:42 ` iains at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-06 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

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

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
fixed on master and for 10.2

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

end of thread, other threads:[~2020-06-06 18:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 17:52 [Bug c++/94829] New: ICE in poplevel, at cp/decl.c:585 asolokha at gmx dot com
2020-04-29  7:22 ` [Bug c++/94829] ICE in poplevel, at cp/decl.c:585 since r10-6063-g49789fd08378e3ff marxin at gcc dot gnu.org
2020-04-29 10:56 ` iains at gcc dot gnu.org
2020-05-07 11:56 ` jakub at gcc dot gnu.org
2020-05-07 20:07 ` cvs-commit at gcc dot gnu.org
2020-06-06 16:51 ` cvs-commit at gcc dot gnu.org
2020-06-06 18:42 ` iains 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).