From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9BE4C3861029; Tue, 30 Jun 2020 12:46:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BE4C3861029 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593521188; bh=9waTJWkLaQUT0cw+K1qiobvfJU903FxfMA3g+zqsC2M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qHcgMfAh7197hGR2rvh2EMAOpH/UbPtmokp6hhQ6NBobIZ72cyuaV3f6S8zehDeUs GnmO/dr9WJtpMU2rntcdAR0wg35mhXSUYdoaVju3WZzLstwi0cFER/fKsIApNy06FE VcE7XEHWwTP8OL97IGVL+6CpRX+zHMHzP0CvkPO8= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95736] coroutine method improperly copies awaitable Date: Tue, 30 Jun 2020 12:46:28 +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: 10.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: iains at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.2 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, 30 Jun 2020 12:46:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95736 --- Comment #4 from CVS Commits --- The releases/gcc-10 branch has been updated by Iain D Sandoe : https://gcc.gnu.org/g:c5a90f61ace5aca821224a658c223881d5b02388 commit r10-8394-gc5a90f61ace5aca821224a658c223881d5b02388 Author: Iain Sandoe Date: Tue Jun 30 08:18:34 2020 +0100 coroutines: Handle awaiters that are sub-objects [PR95736] Move deciding on initializers for awaitables to the build of the co_await, this allows us to analyse cases that do not need a temporary at that point. As the PR shows, the late analysis meant that we were not checking properly for the case that an awaiter is a sub-object of an existing variable outside the current function scope (and therefore does not need to be duplicated in the frame). gcc/cp/ChangeLog: PR c++/95736 * coroutines.cc (get_awaitable_var): New helper. (build_co_await): Check more carefully before copying an awaitable. (expand_one_await_expression): No initializer is required when the awaitable is not a temp. (register_awaits): Remove handling that is now completed when the await expression is built. gcc/testsuite/ChangeLog: PR c++/95736 * g++.dg/coroutines/pr95736.C: New test. (cherry picked from commit daaed0199ee57013ae011421a7e90b7bdd295373)=