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 A36713858D32 for ; Mon, 23 Jan 2023 08:25:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A36713858D32 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=1674462356; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=phCof7izWSuoLqiSJJZvDGnM+7ullRMuOr6SBSVQ4XI=; b=E2JilarFweMF79OtaGRb8aXyF25domB3nUOh1utY9SN/IiLMpb7KBP074ZSLWkkT2/+qCf OAFLVvixhpyay0wUmy7Rt5lVA3GSDUfyB/XNnjwjR4YAwNyF5PXh3xIJrLYNtS/yRcunKa GQ2a4EXGhoFv1av2LKrQ3sp6GJCpgtw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-438-VuWyJnD0NRG8A9tj6TP4xw-1; Mon, 23 Jan 2023 03:25:54 -0500 X-MC-Unique: VuWyJnD0NRG8A9tj6TP4xw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C7F21C0513A for ; Mon, 23 Jan 2023 08:25:54 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 53312140EBF4; Mon, 23 Jan 2023 08:25:54 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 30N8PpQJ1538149 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 23 Jan 2023 09:25:51 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 30N8PolG1538148; Mon, 23 Jan 2023 09:25:50 +0100 Date: Mon, 23 Jan 2023 09:25:50 +0100 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] c++: Handle structured bindings like anon unions in initializers [PR108474] Message-ID: Reply-To: Jakub Jelinek References: <799bfe17-b60d-7353-d676-5296e64b3769@redhat.com> <6f8e0faf-55eb-cf20-e796-a1828197bb23@redhat.com> MIME-Version: 1.0 In-Reply-To: <6f8e0faf-55eb-cf20-e796-a1828197bb23@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 Sun, Jan 22, 2023 at 07:19:07PM -0500, Jason Merrill wrote: > > I was just trying to be careful, because unfortunately this spot > > doesn't mean it really is only expanded in static var DECL_INITIAL, > > it can make it into dynamic initializers, and most of DECL_VALUE_EXPRs > > appear only in runtime code, otherwise we'd have much more of these issues. > > But it shouldn't be harmful anywhere, right? > > > But if you think it is ok, I'll test tonight a version just with > > if (!data->genericize && DECL_HAS_VALUE_EXPR_P (stmt) > > OK with that change. > > Though, actually, why not instead fix expand_expr_real_1 (and staticp) to > look through DECL_VALUE_EXPR? I'm afraid that is way too late. GIMPLE optimizations don't try to regimplify expressions they take from DECL_INITIAL of static vars, they just unshare them and use them. So, if this is to be done in the generic code, it would need to be done by cgraph around the time when it gimplifies function if there is any such point for variables. Jakub