From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3BFE33858D1E for ; Tue, 4 Oct 2022 03:53:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3BFE33858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664855592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lBIXBelFGnQCmXgWp0265oTeH1BcXt5vK4PDlODz6Ls=; b=RdxVTUD/FISpemkkQLPwsCCFdkQCS1K8hA71Tkaac+Wjsviqq7SC99itOx5EIcjPqZi9zy c4uxjXwFSSYxf9juUsSN7oOyqJOyFYawxjVf60QZgOt2SMGVl6lUgrwbsAsh0F5VRisldL 6W1wWi9dqnzfYhbKNgfnyObgvDPHTqw= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-326-J4788ZeHOaW0f8WKYDyDmA-1; Mon, 03 Oct 2022 23:53:11 -0400 X-MC-Unique: J4788ZeHOaW0f8WKYDyDmA-1 Received: by mail-qk1-f197.google.com with SMTP id k2-20020a05620a414200b006ceec443c8bso10700458qko.14 for ; Mon, 03 Oct 2022 20:53:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=lBIXBelFGnQCmXgWp0265oTeH1BcXt5vK4PDlODz6Ls=; b=i5tNN/+umFI6QaZ1RK6B6VhDIt3uhXhebhetTXu/z6N5DC8cVljPaTZEGbPALoWTo2 PFv95mNXsrl+WC+ddwYHVhZ7wkzX5z9/lFoE3ksqi7klYherf2XcqPYo1bJKT428Tg21 ebyXQgZfy5+sM9e8LOBPvJwstYh0QCK2XPmTDqRZMxDkwFU7NYh41z0DcH0AFQkdh33j xjxNhht0KlgJa0rZeE/1oygf9QgQMyEYt0zOz3qjxLS0mccnJhnmgFEw6rmrVZlmGtdW xcTW1FdqWGff8QL2SaQpptyicz0i9VAMWZGS90Gvu5CNa5NHIHj4RTcejT1PWg1OwGmz 9xUw== X-Gm-Message-State: ACrzQf2K5f4EnFA2h0QczQdeoWf1Pc2VN6y9jGYZypCzQSvTpALbycNj fpDsGk3vV2bafGoL2jSXLADMJRbwqVabw+1c8575BKNx8LTapsY6s6oA6JBnUEEgE1sXL9KEhPM S8/1fXUkaL8GButazbg== X-Received: by 2002:a05:620a:f15:b0:6cf:1efa:3705 with SMTP id v21-20020a05620a0f1500b006cf1efa3705mr15607141qkl.439.1664855589018; Mon, 03 Oct 2022 20:53:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7A5QObCA6Z1C5+U3IB8A13W7bz1sAdx8VaJl7PmC7nOPuh95dMP825XBsKvhq6SMHhjmlC1Q== X-Received: by 2002:a05:620a:f15:b0:6cf:1efa:3705 with SMTP id v21-20020a05620a0f1500b006cf1efa3705mr15607137qkl.439.1664855588734; Mon, 03 Oct 2022 20:53:08 -0700 (PDT) Received: from [192.168.1.101] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id w2-20020a05620a444200b006dfa0891397sm721273qkp.32.2022.10.03.20.53.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Oct 2022 20:53:08 -0700 (PDT) Message-ID: Date: Mon, 3 Oct 2022 23:53:06 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH RFC] c++: fix broken conversion in coroutines To: Iain Sandoe Cc: GCC Patches References: <20220930220623.2161990-1-jason@redhat.com> <219253A3-8202-4286-9621-982BC5CD24DF@sandoe.co.uk> From: Jason Merrill In-Reply-To: <219253A3-8202-4286-9621-982BC5CD24DF@sandoe.co.uk> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 9/30/22 18:50, Iain Sandoe wrote: > Hi Jason, > >> On 30 Sep 2022, at 23:06, Jason Merrill wrote: >> >> You can't use CONVERT_EXPR to convert between two class types, and it was >> breaking copy elision. >> >> Unfortunately, this patch breaks symmetric-transfer-00-basic.C, where >> susp_type is Loopy::handle_type. How is this supposed to work? > > We are trying to save a type-erased handle (which the symmetric transfer makes > and indirect call through, nothing else). The problem is you're treating one class directly as another class here, without the indirection involved in usual type-erasure idioms. It does seem that the gimplifier handles this fine, but it doesn't correspond to anything in the language and much of the front end assumes that CONVERT_EXPR is only used for scalars. VIEW_CONVERT_EXPR would better express that we're not doing anything to the value, just cheating the type system. That's still dodgy from a language perspective, but probably safe enough in this case. Note that I was wrong to mention copy elision above; it's irrelevant to codegen here since the handle type returns in a register. > so, I suppose the equivalent could be: > > conthand = coroutine_handle::from_address (suspend.address()) That sounds more correct, yes. Jason