From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 05B1A3858C53; Tue, 26 Apr 2022 10:07:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05B1A3858C53 From: "avi at scylladb dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105373] miscompile involving lambda coroutines and an object bitwise copied instead of via the copy constructor Date: Tue, 26 Apr 2022 10:07:08 +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.3.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: avi at scylladb dot com X-Bugzilla-Status: UNCONFIRMED 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: 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: Tue, 26 Apr 2022 10:07:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105373 --- Comment #7 from Avi Kivity --- To give more context: struct ._anon_973 D.2159793 [value-expr: frame_ptr->D.2159793_4_7]; struct lw_shared_ptr D.2159792 [value-expr: frame_ptr->D.2159792_4_7]; (I determined that _anon_973 is the non-coroutine-lambda that is giving me grief) frame_ptr->D.2159793_4_7.__this =3D _51; frame_ptr->D.2159793_4_7.__old4 =3D frame_ptr->D.2159792_4_7; _52 =3D frame_ptr->__closure; _53 =3D _52->__newtabs; frame_ptr->D.2159793_4_7.__newtabs =3D _53; Here I suspect copying __old4 is bypassing the copy constructor. The source= of the copy (D.2159792) has lw_shared_ptr type. I'm not fluent in gimple so maybe I'm misinterpreting it.=