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.129.124]) by sourceware.org (Postfix) with ESMTPS id 2C02E3858D20 for ; Tue, 30 May 2023 21:08:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C02E3858D20 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=1685480935; 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=xIyxeKYUx/aDsDE8UwdNb1yB7+PbMyc5oikaSFq5yqM=; b=AI+CnszxPheNYWw3oLsksyk3rOeYgGnemTGchTDXe+LF99LWaGAur5eWhjch3+vU0wMfTO s7BcEgti4uZ4G2ILjkehjfqS/Kbc4fz3DrpJbiftKjspID7EUs2eTgXnj82+VNJwjGESO7 cy+rrLmrWbJ7ZB0EF5C2dKFBV6asWVQ= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-Iba_8TVLN_mwQeXhrBF_BA-1; Tue, 30 May 2023 17:08:54 -0400 X-MC-Unique: Iba_8TVLN_mwQeXhrBF_BA-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6261a0b2391so18661856d6.1 for ; Tue, 30 May 2023 14:08:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685480934; x=1688072934; 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:message-id:reply-to; bh=xIyxeKYUx/aDsDE8UwdNb1yB7+PbMyc5oikaSFq5yqM=; b=Vv0ZYfGnTxTp7v28hLgZGtTqboTKHyZ1dgY0lXy/gzsir9TQHAKPVmrbbOKtow5uKx Ff1jZdw+an9+ixFozf0DuhORfe92aPrG7okthjOezKZxYo+jqONhb9joGQkFzdUvJdC9 EZ49vyQNnb9sR3ZpwPuaDuf/TAcuhv8XOP+H7YVm03WWX56NYKDu8qVjKOM+gkiFznXw SnB/wzMt7qNZmzfKU2a3uJ91BVJeDpRTJGYgJmVmgMfjDdJaTC1XY0KVXiI86v4E3rRv wPcNiHwN+KaKGQNXstPKAlAlW4yN+sAPykmQWRzniVg9AuFZkiqrbzxP4HWc0UKtAFcN tOPA== X-Gm-Message-State: AC+VfDzuNnLqBEkJuQ+uF+4qjvrmHbSZvuRZqu/4RYJWME8yGxHXurGL 5AE0f+WwxzYi0ZWWLatJI/YGcfZoj6qKmtZU1pgNwtB2qh5SnHKEYXlPhzOlLjQmTWZOm06G88N E/sqN+edOziLZFuSH+g== X-Received: by 2002:a05:6214:2583:b0:626:ca8:e4f7 with SMTP id fq3-20020a056214258300b006260ca8e4f7mr4031028qvb.56.1685480933907; Tue, 30 May 2023 14:08:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4W5UURH2NyJX9yZ4CtG/FeQPwTohsfX3jTMpFNoKcC2X+0e6UABrk3rLa2QjMMB+5vXM6Y4A== X-Received: by 2002:a05:6214:2583:b0:626:ca8:e4f7 with SMTP id fq3-20020a056214258300b006260ca8e4f7mr4031012qvb.56.1685480933683; Tue, 30 May 2023 14:08:53 -0700 (PDT) Received: from [192.168.1.108] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id et18-20020a056214177200b006212456fd8asm4905116qvb.100.2023.05.30.14.08.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 May 2023 14:08:53 -0700 (PDT) Message-ID: <0557c10a-ad0a-58fb-cb65-5aeb879838e9@redhat.com> Date: Tue, 30 May 2023 17:08:52 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] tree: Fix up save_expr [PR52339] To: Jakub Jelinek Cc: Eric Botcazou , gcc-patches@gcc.gnu.org, Richard Biener , "Joseph S. Myers" References: <3739233.kQq0lBPeGt@fomalhaut> <0365d669-bfe7-c2ff-54a3-67dc30fd4029@redhat.com> <4485641.LvFx2qVVIh@fomalhaut> <93143e27-abd3-bb7d-38e4-0216b81587fa@redhat.com> From: Jason Merrill In-Reply-To: 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=-6.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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 5/30/23 16:51, Jakub Jelinek wrote: > On Tue, May 30, 2023 at 04:36:34PM -0400, Jason Merrill wrote: >> Note that it is fine to treat p->fld as invariant in C++ if fld is >> TREE_READONLY and p is itself invariant. The implementation is allowed to >> assume that other code didn't destroy *p and create a new object with a >> different value of p in the same location under >> https://eel.is/c++draft/basic.memobj#basic.life-8.3 > > You mean > #include > struct S { const int fld; S (int x) : fld (x) {} }; > int foo (S *p) > { > int a[p->fld]; > delete p; > return sizeof (a); > } > is invalid (sure, VLA is an extension)? Good point, no, I would expect that to work, since the user didn't actually write p->fld again. Jason