From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 8F48F3858D20 for ; Wed, 23 Feb 2022 17:33:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F48F3858D20 Received: by mail-wm1-x32f.google.com with SMTP id v2-20020a7bcb42000000b0037b9d960079so2063593wmj.0 for ; Wed, 23 Feb 2022 09:33:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JvtZwfvSqhAa1o4Tse5wFekssHDE2EeUE0eXDAn5Odk=; b=RXiKde2hZO+HnLaLls/735WK0TicYdt3LUthk3TH7cpkyFKaybgDl7qyK5EF6+emeE fgYaUpDEqJ9LirSsmksKs7J9h7akJhF3+uSUqaSgxLH4dRPh0XqUlE8IuSetGN1ugxhI RP9/DDkry8DzmLb0CoqlJXMDXRWF8au7gNmGnoihkWlIq2yCfNfs44+BRpEKLjg6WxHG SYHevsYBe5GCkjAr+/aOIDDlYk4D8ZBnjmVyn8YDYUzgTpAZKX/Nz6ndTatMWR+Kvo4j KSk46MegtxFAPmgMmQpmhoVmrsypFBAHiQ6BOH2ZtaMw8BROUYsFDMEC2WVhCMy/Cyy9 lLDA== X-Gm-Message-State: AOAM533reQrk2jlwnMFnZBJjWpEUclIJJrNOsbrPuRtrs+v8dZOryuEN DJxrkVfrdErmSAcIhF2R/xeUyw== X-Google-Smtp-Source: ABdhPJxHsAq35DgTogDSYxdw5Wj/1wucRboOvlMQuLrQrqnl4QoLAtWgLbBsKfGgznfzZP9FKDycnQ== X-Received: by 2002:a7b:c141:0:b0:381:8a:21e5 with SMTP id z1-20020a7bc141000000b00381008a21e5mr1433179wmi.155.1645637624520; Wed, 23 Feb 2022 09:33:44 -0800 (PST) Received: from fomalhaut.localnet ([2a01:e0a:41b:84f0:cf71:f5e0:b050:bede]) by smtp.gmail.com with ESMTPSA id p11sm188043wrr.16.2022.02.23.09.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 09:33:44 -0800 (PST) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: Philip Herron Cc: gcc Mailing List , gcc-rust@gcc.gnu.org Subject: Re: qual_union_type help Date: Wed, 23 Feb 2022 18:33:43 +0100 Message-ID: <4169450.ejJDZkT8p0@fomalhaut> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Feb 2022 17:33:47 -0000 > This makes sense this we can't gimplify a placeholder expression. So > this seems that when i make a constructor for the QUAL_UNION_TYPE i > must iterate the fields and replace the placeholder_expr to have a > reference to the discriminant via another COMPONENT_REF. Though does > this mean for the constructor i will need to create a temporary to > hold onto it to create another component_ref? The Ada compiler gets rid of all PLACEHOLDER_EXPRs in CONSTRUCTORs because the subtype of these CONSTRUCTORs is always constrained in Ada parlance, i.e. you know the value of the discriminant since it is assigned in the CONSTRUCTOR, so the gimplifier is indeed presumably not wired to eliminate them on its own. -- Eric Botcazou