From patchwork Mon Oct 11 13:39:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 46079 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 16821385800A for ; Mon, 11 Oct 2021 13:43:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16821385800A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1633959806; bh=/VbBChdqFuEHGvy+FmYzbokagqPNjeESfsn0NSNXESY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rG4hixcvS+MgaczW1JzJ+NRn8tum0MRfs/v2fYRpQvURbpTEMEMnwx/Yb2wvY6cPU 6Nb5/gcpoBnJR+YEhxYWyU+MraMCOrmnSc9zmUI/DsN78SidzJd8Q37aDdVSQ50nwf zy/Jgl0IDU0Oc7FKsqRqP51MqQebDVtSdW0qqpXQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id 727BB3858421 for ; Mon, 11 Oct 2021 13:39:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 727BB3858421 Received: by mail-lf1-x134.google.com with SMTP id y15so73901768lfk.7 for ; Mon, 11 Oct 2021 06:39:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=/VbBChdqFuEHGvy+FmYzbokagqPNjeESfsn0NSNXESY=; b=ZI/iuMSZCGTA2B6syTkmp1/s4dCf6PbG7DADQ3i8t3rqfM5EdONEHEtxXp7aa4VK/K tQPkpOyUs5GwKowxCXXSWaCAglKlgIlFczHKcjyTUqppwwGuLLyRk1GB0znh0xA+mZHH SM1KePXKfy5eiyGP2QaoSbK4+M5BA0M1k3hjqlvMgmAeFS3u36hcm+KKU/QnsU0MQSZT HqE9QWoNeuAbzYMCnbJJNnX9FEL1ZtVpa7pSikee18mh4px7+5fR9ge72HRLfB2T5u1n 8Y94Gdq7VrCt+jvDvJFH/0873lwFYWvUreIvSIr5XqAi2YbTjSeLaVcahvcQNKfecavr RI/w== X-Gm-Message-State: AOAM533YtzgPPG2tmIsBsqwo2MY2b/KeJ81YK+JbcfqZnW5L4YMixeUb wDy/6jJ8zXASe+Ui0NSd9iRWQcsUD+9HnQ== X-Google-Smtp-Source: ABdhPJy6GxwwCpNShhEt/WCd7a9rLNZABnI12dmZxKy7in2ma6H8xYxXYiLuBDwvwoMy4GAmvfCCSg== X-Received: by 2002:ac2:4428:: with SMTP id w8mr3095892lfl.139.1633959549469; Mon, 11 Oct 2021 06:39:09 -0700 (PDT) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id z22sm159482ljh.73.2021.10.11.06.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 06:39:08 -0700 (PDT) Date: Mon, 11 Oct 2021 13:39:07 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Do not clear Analyzed flag in expand if already set by preanalysis Message-ID: <20211011133907.GA1518596@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" During Expand, prevent the clearing of the Analyzed flag if it has already been set by Fold_Ureal. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * expander.adb (Expand): Skip clearing of Analyzed flag if already set for N_Real_Literal. diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb --- a/gcc/ada/expander.adb +++ b/gcc/ada/expander.adb @@ -49,6 +49,7 @@ with Sem_Ch8; use Sem_Ch8; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Sinfo.Nodes; use Sinfo.Nodes; +with Stand; use Stand; with Table; package body Expander is @@ -152,7 +153,19 @@ package body Expander is -- not take place. This prevents cascaded errors due to stack mismatch. elsif not Expander_Active then - Set_Analyzed (N, Full_Analysis); + + -- Do not clear the Analyzed flag if it has been set on purpose + -- during preanalysis in Fold_Ureal. In that case, the Etype field + -- in N_Real_Literal will be set to something different than + -- Universal_Real. + + if Full_Analysis + or else not (Nkind (N) = N_Real_Literal + and then Present (Etype (N)) + and then Etype (N) /= Universal_Real) + then + Set_Analyzed (N, Full_Analysis); + end if; if Serious_Errors_Detected > 0 and then Scope_Is_Transient then Scope_Stack.Table