From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 818E53858D20 for ; Wed, 23 Feb 2022 17:45:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 818E53858D20 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-x62a.google.com with SMTP id p14so53929243ejf.11 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=cuf4k2MkwJ1b0O+0Wf0yA/64HNyQYeAhDpK+I2KhB9G/5WHm6Jn9ewkoQNq+i9qcMA vXl2cAWEa7Wvugv13CYq4q1EMBOHCsk8/HaS14KzWfwfZxtPbA7tq4/Ap8HWNnK1vftn RhAJMkXQuHTOLgsDyTawsKO8MuEWT4GgSinPgJznI4EDeqYoGtQpYktgZFJjw3aF7ymA svUVNq/GSWN+OWzKa9Hq5dQcpt4FfGlO+TvPkwNYWGcM4/taC+UwY+Nksr0O1b6FKu0A 8/oPe2KQs25OzJX99agGxoeHObY2ENR2HkqdzxgBZ/Z3NntEhsxtcd4OROGao+HqISmp 4hQw== X-Gm-Message-State: AOAM532jVXndVNrG/q4FghRbxHYZu1oPU33tKv68wnEclrTC4ulGrHbs 1HEM8y4PM/B/yLfxkxrSLF+lkJP/NKJPz/4mZybu8g== 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=-1.8 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: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 > >