From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36401 invoked by alias); 13 Feb 2020 18:20:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 36390 invoked by uid 89); 13 Feb 2020 18:20:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=suspend, Coroutines, wg21, googlemail.com X-HELO: mail-wm1-f67.google.com Received: from mail-wm1-f67.google.com (HELO mail-wm1-f67.google.com) (209.85.128.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Feb 2020 18:20:48 +0000 Received: by mail-wm1-f67.google.com with SMTP id a9so7849966wmj.3 for ; Thu, 13 Feb 2020 10:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YUNdfFJpIy/HW2qbu65YZum1/R5F/QCrQeIxbekv/ag=; b=FISTcwU+vRvOtBnKvGVQ6jHNkN3S5GnbL6SAgpqKVccuQI5Q5iYOq4b3qN5rUoJ5EZ XA4O024ML1jBttF3p37RN8t9MgVhNyPSecGQYoy8hFBFxe/cjKWGDxw/fDagQ/MISVaV QpRd+D2E/PWT5IU5ZnUayb7EzZlACp+QcVAByK1Gui0/OS3AEZSFNb/Jn0kExFjwBN+J txLZM2aY2pfcXhOuZCraeCt55RL2yzGVMhgEawa4x/aC4j6iSHWwndgHjlY3shKfqAid tZsiDc4eAvVvuibsNGQ7E8eOIZEBh5yqEcEnG5ox4T2Ylm6inUvnSZh8bmSUK3/CrRqm CxaA== Return-Path: Received: from [10.0.28.7] ([193.85.242.99]) by smtp.googlemail.com with ESMTPSA id p11sm3788317wrn.40.2020.02.13.10.20.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Feb 2020 10:20:45 -0800 (PST) Content-Type: text/plain; charset=utf-8; delsp=yes; format=flowed Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH Coroutines]Insert the default return_void call at correct position From: Iain Sandoe In-Reply-To: <51A7E0F6-5491-4633-A40C-0234FF597E26@sandoe.co.uk> Date: Thu, 13 Feb 2020 18:20:00 -0000 Cc: GCC Patches Content-Transfer-Encoding: 8bit Message-Id: References: <2f70c962-124a-4fb5-9f0a-ce1ee9d38a54.bin.cheng@linux.alibaba.com> <51A7E0F6-5491-4633-A40C-0234FF597E26@sandoe.co.uk> To: "Bin.Cheng" , Nathan Sidwell X-SW-Source: 2020-02/txt/msg00804.txt.bz2 Hello Bin, Nathan, Iain Sandoe wrote: > > > We are seeking to clarify the standard wording around this (and the cases > where > unhandled_exception() returns - hopefully during the WG21 meeting this > week, > > FWIW, I think your interpretation makes sense here. It’s not clear if the committee will have time to process wording changes needed for this during the current session, however, it is agreed that injecting the return_void at the closing brace of the user’s original function (your solution) is the correct approach. So, from my point of view this patch DTRT and should be applied, thanks Iain >> Thanks, >> bin >> >> On Mon, Feb 3, 2020 at 1:55 PM bin.cheng >> wrote: >>> Hi, >>> >>> Exception in coroutine is not correctly handled because the default >>> return_void call is now inserted before the finish suspend point, >>> rather than at the end of the original coroutine body. This patch >>> fixes the issue by generating following code: >>> co_await promise.initial_suspend(); >>> try { >>> // The original coroutine body >>> >>> promise.return_void(); // The default return_void call. >>> } catch (...) { >>> promise.unhandled_exception(); >>> } >>> final_suspend: >>> // ... >>> >>> Bootstrap and test on x86_64. Is it OK? >>> >>> Thanks, >>> bin >>> >>> gcc/cp >>> 2020-02-03 Bin Cheng >>> >>> * coroutines.cc (build_actor_fn): Factor out code inserting the >>> default return_void call to... >>> (morph_fn_to_coro): ...here, also hoist local var declarations. >>> >>> gcc/testsuite >>> 2020-02-03 Bin Cheng >>> >>> * g++.dg/coroutines/torture/co-ret-15-default-return_void.C: New.