public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97587] New: [coroutines] promise_type constructor is called with original parameters, not parameter copies
@ 2020-10-27  5:35 jehelset at gmail dot com
  2021-02-16  8:47 ` [Bug c++/97587] " iains at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jehelset at gmail dot com @ 2020-10-27  5:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97587
           Summary: [coroutines] promise_type constructor is called with
                    original parameters, not parameter copies
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jehelset at gmail dot com
  Target Milestone: ---

Created attachment 49443
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49443&action=edit
Program that results in assertion-failure due to wrong arguments to promise.

The promise-type constructor should be called with the parameter copies from
the coroutine-frame. I couldn't quite understand that this is supposed to be
the case from the current draft of the standard, but I got some help from Lewis
Baker who also referred me to this rewording, where in the previous version it
is clear: 

https://github.com/cplusplus/draft/commit/0b4ab68a54e197eba9d894a8f91270bb0dcdb546

The attached code triggers an assertion that show that this is not the case on
gcc. I initially had the problem on gcc-10.2.0, but reproduced it on gcc-trunk
on godbolt. Compile either version with -fcoroutines, or see
https://gcc.godbolt.org/z/j16Wqx.

I speculated that the logic here,
https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/coroutines.cc#L4491-L4494,
was inverted. It seemed to pass the copied version of a by-reference parameter,
but the original version of a by-value parameter. The opposite would not
trigger the assertion. But I am not that familiar.

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

end of thread, other threads:[~2021-03-24 12:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27  5:35 [Bug c++/97587] New: [coroutines] promise_type constructor is called with original parameters, not parameter copies jehelset at gmail dot com
2021-02-16  8:47 ` [Bug c++/97587] " iains at gcc dot gnu.org
2021-02-25 19:34 ` cvs-commit at gcc dot gnu.org
2021-03-22 22:03 ` cvs-commit at gcc dot gnu.org
2021-03-24 12:45 ` 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).