public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94817] New: ICE in add_stmt, at cp/semantics.c:392
@ 2020-04-28 12:35 asolokha at gmx dot com
  2020-04-28 14:16 ` [Bug c++/94817] ICE in add_stmt, at cp/semantics.c:392 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 12:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94817
           Summary: ICE in add_stmt, at cp/semantics.c:392
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++-10.0.1-alpha20200426 snapshot (g:29f55115583a0dab6cbac749c4f0804fd88e9536)
ICEs when compiling the following testcase, extracted from
clang/testsuite/SemaCXX/coroutines.cpp from the clang 10.0.0 test suite, w/
-fcoroutines:

void no_coroutine_traits() {
  co_await 4;
}

template <class... Args>
struct void_t_imp {
  using type = void;
};

% g++-10.0.1 -fcoroutines -c e96qfdep.cpp
e96qfdep.cpp: In function 'void no_coroutine_traits()':
e96qfdep.cpp:2:3: error: coroutines require a traits template; cannot find
'std::coroutine_traits'
    2 |   co_await 4;
      |   ^~~~~~~~
e96qfdep.cpp:2:3: note: perhaps '#include <coroutine>' is missing
e96qfdep.cpp:8:1: internal compiler error: in add_stmt, at cp/semantics.c:392
    8 | };
      | ^
0x678153 add_stmt(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/semantics.c:392
0x89887a finish_struct(tree_node*, tree_node*)
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/class.c:7563
0x999413 cp_parser_class_specifier_1
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:23881
0x99b4bb cp_parser_class_specifier
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:24180
0x99b4bb cp_parser_type_specifier
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:17711
0x99c5c5 cp_parser_decl_specifier_seq
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:14359
0x9c3c78 cp_parser_single_declaration
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:29396
0x9c402c cp_parser_template_declaration_after_parameters
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:29059
0x9c4790 cp_parser_explicit_template_declaration
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:29325
0x9c79a9 cp_parser_declaration
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:13382
0x9c7fef cp_parser_translation_unit
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:4734
0x9c7fef c_parse_file()
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:43975
0xae0edb c_common_parse_file()
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/c-family/c-opts.c:1190

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

* [Bug c++/94817] ICE in add_stmt, at cp/semantics.c:392 since r10-6063-g49789fd08378e3ff
  2020-04-28 12:35 [Bug c++/94817] New: ICE in add_stmt, at cp/semantics.c:392 asolokha at gmx dot com
@ 2020-04-28 14:16 ` 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-28 14:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- 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++/94817] ICE in add_stmt, at cp/semantics.c:392 since r10-6063-g49789fd08378e3ff
  2020-04-28 12:35 [Bug c++/94817] New: ICE in add_stmt, at cp/semantics.c:392 asolokha at gmx dot com
  2020-04-28 14:16 ` [Bug c++/94817] ICE in add_stmt, at cp/semantics.c:392 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=94817

--- 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++/94817] ICE in add_stmt, at cp/semantics.c:392 since r10-6063-g49789fd08378e3ff
  2020-04-28 12:35 [Bug c++/94817] New: ICE in add_stmt, at cp/semantics.c:392 asolokha at gmx dot com
  2020-04-28 14:16 ` [Bug c++/94817] ICE in add_stmt, at cp/semantics.c:392 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=94817

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++/94817] ICE in add_stmt, at cp/semantics.c:392 since r10-6063-g49789fd08378e3ff
  2020-04-28 12:35 [Bug c++/94817] New: ICE in add_stmt, at cp/semantics.c:392 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:41 ` 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=94817

--- 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++/94817] ICE in add_stmt, at cp/semantics.c:392 since r10-6063-g49789fd08378e3ff
  2020-04-28 12:35 [Bug c++/94817] New: ICE in add_stmt, at cp/semantics.c:392 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:41 ` 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=94817

--- 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++/94817] ICE in add_stmt, at cp/semantics.c:392 since r10-6063-g49789fd08378e3ff
  2020-04-28 12:35 [Bug c++/94817] New: ICE in add_stmt, at cp/semantics.c:392 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2020-06-06 16:51 ` cvs-commit at gcc dot gnu.org
@ 2020-06-06 18:41 ` 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:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- 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:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 12:35 [Bug c++/94817] New: ICE in add_stmt, at cp/semantics.c:392 asolokha at gmx dot com
2020-04-28 14:16 ` [Bug c++/94817] ICE in add_stmt, at cp/semantics.c:392 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:41 ` 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).