From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 91C103858D39 for ; Wed, 23 Feb 2022 17:33:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 91C103858D39 Received: by mail-wm1-x32e.google.com with SMTP id l1-20020a7bcf01000000b0037f881182a8so2042650wmg.2 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=CmPiBLm3bTXQa8/5xT0b2xOZIu7RJHwh7hqJZm4bDbHxPo/h4p0p0/ZosP1lLOG36V QKIcuQs/wFt2jxu3EevWsimO3VPWOa8GcQKfGjSUYjmi5c4VdCzZTa5abTl1i0s5oprj 4pqHEQ1JKrTHFE2jxGjdR4AnAWjHCkTSPeEdWeDpKTOrUBFvdZ3ccPHJeiieSjvDh8sw AnFG05Y3nelbnf9cAdGmU9SnfErdHGcbYIpXQXJrWwsFhXVLYCsvQsHlGw6v9JfrhhVe NaA0HJD/bBVlH7vTdl9Qpjgou1VGu7R85tVR1C8xuO5agE4321lv3Gb4YAw/0tyQdXpc XlNQ== X-Gm-Message-State: AOAM5334rgB9IHzs9kiJkXkRqvk4piQ65Nk9Jphu3i/zKn3dZop9+YWX cXgkQAtFpYdC5Uy/SKK6DUJLGA== 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=-5.3 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-rust@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: gcc-rust 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