public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name
@ 2020-06-03 23:42 bruck.michael at gmail dot com
  2020-06-04 19:57 ` [Bug c++/95520] " iains at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: bruck.michael at gmail dot com @ 2020-06-03 23:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95520
           Summary: [coroutines] __builtin_FUNCTION() returns mangled
                    .actor instead of original function name
           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: ---

#include <coroutine>
#include <cstdio>

struct pt
{
    using handle_t = std::coroutine_handle<pt>;
    auto get_return_object() noexcept { return handle_t::from_promise(*this); }

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

template <> struct std::coroutine_traits<pt::handle_t>
    { using promise_type = pt; };

static pt::handle_t foo()
{ 
    printf("coroutine name %s\n", __builtin_FUNCTION());
    co_return;
}

int main()
{
    foo();
}
--
prints:
coroutine name _ZL3foov.actor

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

* [Bug c++/95520] [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name
  2020-06-03 23:42 [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name bruck.michael at gmail dot com
@ 2020-06-04 19:57 ` iains at gcc dot gnu.org
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-04 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-06-04
   Target Milestone|---                         |10.2
             Status|UNCONFIRMED                 |NEW
           Assignee|unassigned at gcc dot gnu.org      |iains at gcc dot gnu.org
           Keywords|                            |wrong-code

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

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

* [Bug c++/95520] [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name
  2020-06-03 23:42 [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name bruck.michael at gmail dot com
  2020-06-04 19:57 ` [Bug c++/95520] " iains at gcc dot gnu.org
@ 2020-07-23  6:51 ` rguenth at gcc dot gnu.org
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23  6:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.2 is released, adjusting target milestone.

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

* [Bug c++/95520] [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name
  2020-06-03 23:42 [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name bruck.michael at gmail dot com
  2020-06-04 19:57 ` [Bug c++/95520] " iains at gcc dot gnu.org
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
  2021-05-04 12:32 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.3                        |10.4

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.

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

* [Bug c++/95520] [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name
  2020-06-03 23:42 [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name bruck.michael at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
@ 2021-05-04 12:32 ` rguenth at gcc dot gnu.org
  2021-07-19 20:18 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-04 12:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

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

* [Bug c++/95520] [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name
  2020-06-03 23:42 [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name bruck.michael at gmail dot com
                   ` (3 preceding siblings ...)
  2021-05-04 12:32 ` rguenth at gcc dot gnu.org
@ 2021-07-19 20:18 ` cvs-commit at gcc dot gnu.org
  2021-07-20  6:56 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-19 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:237ab3ee49e2f3110accfcc03b6c0df8b4889f15

commit r12-2400-g237ab3ee49e2f3110accfcc03b6c0df8b4889f15
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Thu Jul 8 09:42:49 2021 +0100

    coroutines: Adjust outlined function names [PR95520].

    The mechanism used to date for uniquing the coroutine helper
    functions (actor, destroy) was over-complicating things and
    leading to the noted PR and also difficulties in setting
    breakpoints on these functions (so this will help PR99215 as
    well).

    This implementation delegates the adjustment to the mangling
    to write_encoding() which necessitates some book-keeping so
    that it is possible to determine which of the coroutine
    helper names is to be mangled.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

    PR c++/95520 - [coroutines] __builtin_FUNCTION() returns mangled .actor
instead of original function name

            PR c++/95520

    gcc/cp/ChangeLog:

            * coroutines.cc (struct coroutine_info): Add fields for
            actor and destroy function decls.
            (to_ramp): New.
            (coro_get_ramp_function): New.
            (coro_get_actor_function): New.
            (coro_get_destroy_function): New.
            (act_des_fn): Set up mapping between ramp, actor and
            destroy functions.
            (morph_fn_to_coro): Adjust interface to the builder for
            helper function decls.
            * cp-tree.h (DECL_ACTOR_FN, DECL_DESTROY_FN, DECL_RAMP_FN,
            JOIN_STR): New.
            * mangle.c (write_encoding): Handle coroutine helpers.
            (write_unqualified_name): Handle lambda coroutine helpers.

    gcc/testsuite/ChangeLog:

            * g++.dg/coroutines/pr95520.C: New test.

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

* [Bug c++/95520] [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name
  2020-06-03 23:42 [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name bruck.michael at gmail dot com
                   ` (4 preceding siblings ...)
  2021-07-19 20:18 ` cvs-commit at gcc dot gnu.org
@ 2021-07-20  6:56 ` cvs-commit at gcc dot gnu.org
  2021-10-03 19:28 ` cvs-commit at gcc dot gnu.org
  2021-10-03 19:39 ` iains at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-20  6:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:3a93c67f21818eafd6823a7c3d06db1432f9c07b

commit r11-8787-g3a93c67f21818eafd6823a7c3d06db1432f9c07b
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Thu Jul 8 09:42:49 2021 +0100

    coroutines: Adjust outlined function names [PR95520].

    The mechanism used to date for uniquing the coroutine helper
    functions (actor, destroy) was over-complicating things and
    leading to the noted PR and also difficulties in setting
    breakpoints on these functions (so this will help PR99215 as
    well).

    This implementation delegates the adjustment to the mangling
    to write_encoding() which necessitates some book-keeping so
    that it is possible to determine which of the coroutine
    helper names is to be mangled.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

    PR c++/95520 - [coroutines] __builtin_FUNCTION() returns mangled .actor
instead of original function name

            PR c++/95520

    gcc/cp/ChangeLog:

            * coroutines.cc (struct coroutine_info): Add fields for
            actor and destroy function decls.
            (to_ramp): New.
            (coro_get_ramp_function): New.
            (coro_get_actor_function): New.
            (coro_get_destroy_function): New.
            (act_des_fn): Set up mapping between ramp, actor and
            destroy functions.
            (morph_fn_to_coro): Adjust interface to the builder for
            helper function decls.
            * cp-tree.h (DECL_ACTOR_FN, DECL_DESTROY_FN, DECL_RAMP_FN,
            JOIN_STR): New.
            * mangle.c (write_encoding): Handle coroutine helpers.
            (write_unqualified_name): Handle lambda coroutine helpers.

    gcc/testsuite/ChangeLog:

            * g++.dg/coroutines/pr95520.C: New test.

    (cherry picked from commit 237ab3ee49e2f3110accfcc03b6c0df8b4889f15)

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

* [Bug c++/95520] [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name
  2020-06-03 23:42 [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name bruck.michael at gmail dot com
                   ` (5 preceding siblings ...)
  2021-07-20  6:56 ` cvs-commit at gcc dot gnu.org
@ 2021-10-03 19:28 ` cvs-commit at gcc dot gnu.org
  2021-10-03 19:39 ` iains at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-03 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:bf455aa06f95edf15b3ee619b1096dde716fed64

commit r10-10165-gbf455aa06f95edf15b3ee619b1096dde716fed64
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Thu Jul 8 09:42:49 2021 +0100

    coroutines: Adjust outlined function names [PR95520].

    The mechanism used to date for uniquing the coroutine helper
    functions (actor, destroy) was over-complicating things and
    leading to the noted PR and also difficulties in setting
    breakpoints on these functions (so this will help PR99215 as
    well).

    This implementation delegates the adjustment to the mangling
    to write_encoding() which necessitates some book-keeping so
    that it is possible to determine which of the coroutine
    helper names is to be mangled.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

    PR c++/95520 - [coroutines] __builtin_FUNCTION() returns mangled .actor
instead of original function name

            PR c++/95520

    gcc/cp/ChangeLog:

            * coroutines.cc (struct coroutine_info): Add fields for
            actor and destroy function decls.
            (to_ramp): New.
            (coro_get_ramp_function): New.
            (coro_get_actor_function): New.
            (coro_get_destroy_function): New.
            (act_des_fn): Set up mapping between ramp, actor and
            destroy functions.
            (morph_fn_to_coro): Adjust interface to the builder for
            helper function decls.
            * cp-tree.h (DECL_ACTOR_FN, DECL_DESTROY_FN, DECL_RAMP_FN,
            JOIN_STR): New.
            * mangle.c (write_encoding): Handle coroutine helpers.
            (write_unqualified_name): Handle lambda coroutine helpers.

    gcc/testsuite/ChangeLog:

            * g++.dg/coroutines/pr95520.C: New test.

    (cherry picked from commit 237ab3ee49e2f3110accfcc03b6c0df8b4889f15)

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

* [Bug c++/95520] [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name
  2020-06-03 23:42 [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name bruck.michael at gmail dot com
                   ` (6 preceding siblings ...)
  2021-10-03 19:28 ` cvs-commit at gcc dot gnu.org
@ 2021-10-03 19:39 ` iains at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2021-10-03 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> ---
so fixed on all open branches

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

end of thread, other threads:[~2021-10-03 19:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 23:42 [Bug c++/95520] New: [coroutines] __builtin_FUNCTION() returns mangled .actor instead of original function name bruck.michael at gmail dot com
2020-06-04 19:57 ` [Bug c++/95520] " iains at gcc dot gnu.org
2020-07-23  6:51 ` rguenth at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-05-04 12:32 ` rguenth at gcc dot gnu.org
2021-07-19 20:18 ` cvs-commit at gcc dot gnu.org
2021-07-20  6:56 ` cvs-commit at gcc dot gnu.org
2021-10-03 19:28 ` cvs-commit at gcc dot gnu.org
2021-10-03 19:39 ` 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).