From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id A515E3858D39 for ; Wed, 23 Feb 2022 17:45:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A515E3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-ej1-x634.google.com with SMTP id gb39so54176794ejc.1 for ; Wed, 23 Feb 2022 09:45:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pzcxKmJz+bkUzYK8tYzOLug8MywwPMI6oqUNfomV0QM=; b=gWQbX6FPuOLWclA+rqzg3ZPbGtKSShtCkgoYCwtO4n3vNvZa+sA5ar1N0a2MtiO+Nm y/NEIbcilKrKJbTLmSxxk1damG/GITuUL+XBjvhw6aE4TiCCnU6aHzOijkLSaoHsMJK3 bT8SPYBeLoQvd33e36ueLHSUJG0Uq++DTBIr5LKUeCBnr8/hxMuHnLn9JPaGhRLa0E4K W5kN8LSa9gEdAjDM0E36Nn6D1Cff7KEGPFt+gqxdtthBbRnF4hSEj7WDV8KT/sa5Sfve VOCNgaQyBZC738shVoxrri0LkHKuKaSfM2AIJpdWvniw7V/a2n//6pShhOskmllEWj+a Z9jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pzcxKmJz+bkUzYK8tYzOLug8MywwPMI6oqUNfomV0QM=; b=dYq1kYvDuJ9gmFgri57OIb1Fia4NuTACC3tM9wAYYv5DJvZm7oufQuOp8HwfF7epBe tkPgg1RnnSg7y6/IjtYzEuLy4F1Pa7p/Q3VfgVs+DvlMCH6b3m7RaW4Z/GqLQmcclgnc 2JvcExewPg9LMJkxY8j5z3+mNZ22pBqBcFVAd4Tf9KlqB+DefT8NYlsAqEmf6xiNbWfy eJwhtl+B2frCZ2aCAGZqkVevoFR2caWEh/Vqoje3NA1iXSBy+3c0d1oFb+QXPxAb5H+y LZ6P7P8iI08SoNOc+kbaWxw0uK1IYC/N1nZsbCOEk9PSkLvcKtKKZCGEOYG0ppdnz6Z6 SZTA== X-Gm-Message-State: AOAM533ivKCP46Wqlanjf55VTpzg1wKYPaZLZofeEZ+5EnoooWJ+Zi+G vjBrtcMsX7tOvSqXdpeApnklSg5fjGzVA/Rz5FiJdTEpO0wtZg== X-Google-Smtp-Source: ABdhPJzzdDcx3qu27YnzRjMN0XEjuncmHrfZbs5pmveRIB/jgGFqXPPNP+Kcryk3aVba1tYZ1BxK+Np9T/8fiPXn2kI= X-Received: by 2002:a17:907:78d1:b0:6ce:70b4:f6f9 with SMTP id kv17-20020a17090778d100b006ce70b4f6f9mr665041ejc.196.1645638310433; Wed, 23 Feb 2022 09:45:10 -0800 (PST) MIME-Version: 1.0 References: <4169450.ejJDZkT8p0@fomalhaut> In-Reply-To: <4169450.ejJDZkT8p0@fomalhaut> From: Philip Herron Date: Wed, 23 Feb 2022 17:44:59 +0000 Message-ID: Subject: Re: qual_union_type help To: Eric Botcazou Cc: gcc Mailing List , gcc-rust@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 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=unavailable 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:45:13 -0000 Hi Eric, That makes sense during construction we also know what the value of the discriminant is. What does the Ada front-end replace the placeholder_exprs with? Can it simply be the value of the discriminant at constructor? I haven't tried that. Thanks --Phil On Wed, 23 Feb 2022 at 17:33, Eric Botcazou wrote: > > > 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 > >