public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95505] New: [coroutines] ICE assert with get_return_object_on_allocation_failure
@ 2020-06-03 16:00 bruck.michael at gmail dot com
  2020-06-04 19:54 ` [Bug c++/95505] " iains at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bruck.michael at gmail dot com @ 2020-06-03 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95505
           Summary: [coroutines] ICE assert with
                    get_return_object_on_allocation_failure
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bruck.michael at gmail dot com
  Target Milestone: ---

https://gcc.godbolt.org/z/2LXQ2c

#include <coroutine>

struct dummy
{
    struct promise_type
    {
        dummy get_return_object() const noexcept { return {}; }
        static dummy get_return_object_on_allocation_failure() noexcept {
return {}; }

        std::suspend_always initial_suspend() const noexcept { return {}; }
        std::suspend_never final_suspend() const noexcept { return {}; }
        void return_void() const noexcept {}
        void unhandled_exception() const noexcept {}
    };
};

dummy foo()
{
    co_return;
}

int main() {}
----

source>: In function 'dummy foo()':
<source>:20:1: internal compiler error: tree check: expected call_expr, have
error_mark in morph_fn_to_coro, at cp/coroutines.cc:4050
   20 | }
      | ^

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

* [Bug c++/95505] [coroutines] ICE assert with get_return_object_on_allocation_failure
  2020-06-03 16:00 [Bug c++/95505] New: [coroutines] ICE assert with get_return_object_on_allocation_failure bruck.michael at gmail dot com
@ 2020-06-04 19:54 ` iains at gcc dot gnu.org
  2020-06-20 15:14 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-04 19:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |10.2
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-06-04

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
thanks for the report.

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

* [Bug c++/95505] [coroutines] ICE assert with get_return_object_on_allocation_failure
  2020-06-03 16:00 [Bug c++/95505] New: [coroutines] ICE assert with get_return_object_on_allocation_failure bruck.michael at gmail dot com
  2020-06-04 19:54 ` [Bug c++/95505] " iains at gcc dot gnu.org
@ 2020-06-20 15:14 ` cvs-commit at gcc dot gnu.org
  2020-06-20 15:40 ` iains at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-20 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:445d8da5fbd10e32f8ea470bd9ac02faba8fd718

commit r11-1572-g445d8da5fbd10e32f8ea470bd9ac02faba8fd718
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Jun 20 14:01:21 2020 +0100

    coroutines: Update handling and failure for g-r-o-o-a-f [PR95505]

    The actual issue is that (in the testcase) std::nothrow is not
    available.  So update the handling of the get-return-on-alloc-fail
    to include the possibility that std::nothrow might not be
    available.

    gcc/cp/ChangeLog:

            PR c++/95505
            * coroutines.cc (morph_fn_to_coro): Update handling of
            get-return-object-on-allocation-fail and diagnose missing
            std::nothrow.

    gcc/testsuite/ChangeLog:

            PR c++/95505
            * g++.dg/coroutines/pr95505.C: New test.

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

* [Bug c++/95505] [coroutines] ICE assert with get_return_object_on_allocation_failure
  2020-06-03 16:00 [Bug c++/95505] New: [coroutines] ICE assert with get_return_object_on_allocation_failure bruck.michael at gmail dot com
  2020-06-04 19:54 ` [Bug c++/95505] " iains at gcc dot gnu.org
  2020-06-20 15:14 ` cvs-commit at gcc dot gnu.org
@ 2020-06-20 15:40 ` iains at gcc dot gnu.org
  2020-06-21 19:18 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-20 15:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
we're also discussing whether there's a good way to make this available
automatically.

clang's current implementation includes <new> unconditionally, which is a
possible solution - I'm not thrilled about blanket inclusion of other library
headers (especially when they are not actually directly used by the including
one).

It's a somewhat odd situation - neither <coroutine> nor (quite likely) the
user's code necessarily overly needs "<new>" .. it's an indirect requirement.

So another possibility is to make the std::no throw_t type available and just
construct a temporary object of that type when doing the lookup.

So the ICE is fixed by diagnosing the issue, and making things 'easier' is on
the TODO (but not part of this PR).

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

* [Bug c++/95505] [coroutines] ICE assert with get_return_object_on_allocation_failure
  2020-06-03 16:00 [Bug c++/95505] New: [coroutines] ICE assert with get_return_object_on_allocation_failure bruck.michael at gmail dot com
                   ` (2 preceding siblings ...)
  2020-06-20 15:40 ` iains at gcc dot gnu.org
@ 2020-06-21 19:18 ` cvs-commit at gcc dot gnu.org
  2020-06-21 19:52 ` iains at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-21 19:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:a59a15bcd27fa626b2b0912a1d7abd6df4f3d6cf

commit r10-8334-ga59a15bcd27fa626b2b0912a1d7abd6df4f3d6cf
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun Jun 21 19:11:23 2020 +0100

    coroutines: Update handling and failure for g-r-o-o-a-f [PR95505]

    The actual issue is that (in the testcase) std::nothrow is not
    available.  So update the handling of the get-return-on-alloc-fail
    to include the possibility that std::nothrow might not be
    available.

    gcc/cp/ChangeLog:

            PR c++/95505
            * coroutines.cc (morph_fn_to_coro): Update handling of
            get-return-object-on-allocation-fail and diagnose missing
            std::nothrow.

    gcc/testsuite/ChangeLog:

            PR c++/95505
            * g++.dg/coroutines/pr95505.C: New test.

    (cherry picked from commit 445d8da5fbd10e32f8ea470bd9ac02faba8fd718)

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

* [Bug c++/95505] [coroutines] ICE assert with get_return_object_on_allocation_failure
  2020-06-03 16:00 [Bug c++/95505] New: [coroutines] ICE assert with get_return_object_on_allocation_failure bruck.michael at gmail dot com
                   ` (3 preceding siblings ...)
  2020-06-21 19:18 ` cvs-commit at gcc dot gnu.org
@ 2020-06-21 19:52 ` iains at gcc dot gnu.org
  2020-06-27 10:45 ` bruck.michael at gmail dot com
  2020-06-27 10:50 ` iains at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-21 19:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug c++/95505] [coroutines] ICE assert with get_return_object_on_allocation_failure
  2020-06-03 16:00 [Bug c++/95505] New: [coroutines] ICE assert with get_return_object_on_allocation_failure bruck.michael at gmail dot com
                   ` (4 preceding siblings ...)
  2020-06-21 19:52 ` iains at gcc dot gnu.org
@ 2020-06-27 10:45 ` bruck.michael at gmail dot com
  2020-06-27 10:50 ` iains at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: bruck.michael at gmail dot com @ 2020-06-27 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Michael Bruck <bruck.michael at gmail dot com> ---
Is it possible to point the user to include <new> here like other parts of gcc
do for standard library functions?
i.e. name-lookup.c missing_std_header

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

* [Bug c++/95505] [coroutines] ICE assert with get_return_object_on_allocation_failure
  2020-06-03 16:00 [Bug c++/95505] New: [coroutines] ICE assert with get_return_object_on_allocation_failure bruck.michael at gmail dot com
                   ` (5 preceding siblings ...)
  2020-06-27 10:45 ` bruck.michael at gmail dot com
@ 2020-06-27 10:50 ` iains at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-27 10:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Michael Bruck from comment #6)
> Is it possible to point the user to include <new> here like other parts of
> gcc do for standard library functions?
> i.e. name-lookup.c missing_std_header

That's also a possibility (we do that for a missing <coroutine> include
already).

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

end of thread, other threads:[~2020-06-27 10:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 16:00 [Bug c++/95505] New: [coroutines] ICE assert with get_return_object_on_allocation_failure bruck.michael at gmail dot com
2020-06-04 19:54 ` [Bug c++/95505] " iains at gcc dot gnu.org
2020-06-20 15:14 ` cvs-commit at gcc dot gnu.org
2020-06-20 15:40 ` iains at gcc dot gnu.org
2020-06-21 19:18 ` cvs-commit at gcc dot gnu.org
2020-06-21 19:52 ` iains at gcc dot gnu.org
2020-06-27 10:45 ` bruck.michael at gmail dot com
2020-06-27 10:50 ` 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).