public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109963] New: ABI: unexpected layout ordering of `this` pointer in lambda capture
@ 2023-05-25  7:20 joker.eph at gmail dot com
  2023-05-25  8:46 ` [Bug c++/109963] " redi at gcc dot gnu.org
  2023-09-27  2:54 ` justin.lebar+bug at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: joker.eph at gmail dot com @ 2023-05-25  7:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109963
           Summary: ABI: unexpected layout ordering of `this` pointer in
                    lambda capture
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joker.eph at gmail dot com
  Target Milestone: ---

See the discussion here: https://github.com/itanium-cxx-abi/cxx-abi/issues/141

Most recent post at the moment was calling out a possible implementation bug in
GCC:

> If compilers aren't going to give lambdas internal linkage in these situations, the ABI needs to define a layout for them. As far as I can tell, Clang, GCC, and ICC are all trying to use the same layout rule: explicit captures are added in declaration order, then implicit captures are added in the source order of their ODR use in the lambda body. The exception which causes this incompatibility is that GCC seems to order implicit this arguments (and only implicit ones) after the formal call arguments. I would argue that that's just a GCC bug, and the this argument should be ordered as if it were written in source. @jicama, do you agree?

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

* [Bug c++/109963] ABI: unexpected layout ordering of `this` pointer in lambda capture
  2023-05-25  7:20 [Bug c++/109963] New: ABI: unexpected layout ordering of `this` pointer in lambda capture joker.eph at gmail dot com
@ 2023-05-25  8:46 ` redi at gcc dot gnu.org
  2023-09-27  2:54 ` justin.lebar+bug at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-25  8:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-05-25

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Repeating the quoted comment, without bugzilla's unhelpful horizontal
scrollbar:

If compilers aren't going to give lambdas internal linkage in these situations,
the ABI needs to define a layout for them. As far as I can tell, Clang, GCC,
and ICC are all trying to use the same layout rule: explicit captures are added
in declaration order, then implicit captures are added in the source order of
their ODR use in the lambda body. The exception which causes this
incompatibility is that GCC seems to order implicit this arguments (and only
implicit ones) after the formal call arguments. I would argue that that's just
a GCC bug, and the this argument should be ordered as if it were written in
source. @jicama, do you agree?

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

* [Bug c++/109963] ABI: unexpected layout ordering of `this` pointer in lambda capture
  2023-05-25  7:20 [Bug c++/109963] New: ABI: unexpected layout ordering of `this` pointer in lambda capture joker.eph at gmail dot com
  2023-05-25  8:46 ` [Bug c++/109963] " redi at gcc dot gnu.org
@ 2023-09-27  2:54 ` justin.lebar+bug at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: justin.lebar+bug at gmail dot com @ 2023-09-27  2:54 UTC (permalink / raw)
  To: gcc-bugs

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

Justin Lebar <justin.lebar+bug at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |justin.lebar+bug at gmail dot com

--- Comment #2 from Justin Lebar <justin.lebar+bug at gmail dot com> ---
I rediscovered this in https://github.com/openai/triton/issues/2398 (along with
Mehdi, coincidentally).

I'm really not sure how we fix this, though.  If gcc changes their ABI, then
new GCC binaries will not be compatible with old ones.  OTOH if nobody changes
their ABI, then we can't pass lambdas between binaries created by the different
compilers.

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

end of thread, other threads:[~2023-09-27  2:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25  7:20 [Bug c++/109963] New: ABI: unexpected layout ordering of `this` pointer in lambda capture joker.eph at gmail dot com
2023-05-25  8:46 ` [Bug c++/109963] " redi at gcc dot gnu.org
2023-09-27  2:54 ` justin.lebar+bug at gmail dot com

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).