From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 61A823947C32; Fri, 28 Jan 2022 20:49:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61A823947C32 From: "iains at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104177] coroutine frame is not being allocated with the correct alignment Date: Fri, 28 Jan 2022 20:49:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.1.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: iains at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status everconfirmed cf_reconfirmed_on Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jan 2022 20:49:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104177 Iain Sandoe changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2022-01-28 --- Comment #13 from Iain Sandoe --- the design that is agreed (by the coroutine "ABI group", at least) is this: If the frame requires greater than pointer alignment * 2, we should place t= he padding **BEFORE** the (resume*)() and (destroy*)() members - and the frame pointer will continue to point to the (resume*)() member. So that, from the point of view of a continuing caller - there is no difference between such frames and ones less-aligned. This requires: 1. keeping some accounting information on the side so that the correct memo= ry can be freed. 2. having an allocator that honours alignment > 2 * pointer (well. I'd guess most do that, but we really need the aligned allocator change, however [as noted in the thread referenced] that change did not make C++20). We can, of course, follow clang. 3. ensuring that excess and user alignments are honoured in the placement of frame entries (I wonder if we actually need to honour anything larger than = then stack would allow). ---- Fro my part, I completely agree that GCC coroutines should support fields w= ill suitable alignment for larger vector objects. It's just a question of find= ing time to implement the changes, as with all projects .... The idea is that coroutines form different compilers should be inter-callab= le (even though the frame layout might be completely different beyond that specified for ABI).=