From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id DBB48395CC03 for ; Wed, 7 Jul 2021 16:25:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DBB48395CC03 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-lf1-x133.google.com with SMTP id n14so5237636lfu.8 for ; Wed, 07 Jul 2021 09:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=2fnPmiq/pnICKoIxJns7HlqJdz9Hytf1zh2khd3LMoM=; b=d3YzIwhqy6iAYYdzdvECciFDYYZYTXdmHyYnWqopCQnlH7t1kNiYvuWjlHKpzsFCBW 0dSm/cvehvjoljwJLtz+Cy0NGefrWJmwrIdg2JJtzzWEegzC0JB8OZbOdyE7PqWKIjsF MtyqGK//mrVpGJcv2ppQQiOzMi8/scSzJSUxuT6N2JfAHzwTUvsM7CQ0+4vC97uVrPtd K+usKdyZLHgxvWPaA21+8KwoN2fBtcgjUhD1fbChPrrk1OOBKH5pQbF/AC5ArcCoUesp wY+kXkzj6J2W/URFbgC4+mUnIsYjhiyvT0HFe09ZKquuh2c2PwdTFaXcoY48Qb4Ck3gy XDDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=2fnPmiq/pnICKoIxJns7HlqJdz9Hytf1zh2khd3LMoM=; b=cZHspGU97adhMvUdZEQF/il7i8cfQxX/uAUSDtf4k8y69WaB1oLdMSrC13yNiloDBP qB5104TnaH5cxf7nSvNPGW2Icw1frV0DPWuJMuhmZIsJiyqCcVT6+QkNMS58E4Qo/YSz I8ZMgrJ8zeCWFycAsE+mDMgaafi03PF1DRCY4vuHIs6wXb58KHrg5jmCYbG/XYdz70OZ SMJlTpJd5s9xurSWfRt0PuZcwXIgZI8bxvIG8TeWpmZJLgRyjV+G7HePJytncM+S69x5 yzouLLyQZdT+ZnyPHHgk2JimXY5IaVCa9B+0fIQKOqCH5hIDx1PXkYN0Polj+q+qlMQC O4hA== X-Gm-Message-State: AOAM533/THmpsP4soxrMRDlyBHbP/5ElDx881Q7yUwxRhd1S0iHpqcQ8 YFMQBHnoz/WwXobuWcn2yuhbteA/CGrX+g== X-Google-Smtp-Source: ABdhPJyaYlLcpbI2zzbgwgexBeGcYaD2Jhiuu7UI28b0fDU/1xTH0v2aXQAS4BDZII4e3yIGrpM+eg== X-Received: by 2002:a2e:9252:: with SMTP id v18mr20234395ljg.122.1625675144711; Wed, 07 Jul 2021 09:25:44 -0700 (PDT) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id s21sm1741739lfc.249.2021.07.07.09.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 09:25:43 -0700 (PDT) Date: Wed, 7 Jul 2021 16:25:43 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Arnaud Charlet Subject: [Ada] Front-end inlining and instantiations of UC Message-ID: <20210707162543.GA2543247@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="17pEHd4RhPHOinZp" Content-Disposition: inline X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, 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-List-Received-Date: Wed, 07 Jul 2021 16:25:47 -0000 --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline A recent change exposed a latent bug where the Is_Intrinsic_Subprogram flag was not propagated properly, leading to errors from the front-end inlining of the form: cannot inline "xxx" (nested function instantiation) Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch12.adb (Analyze_Subprogram_Instantiation): Mark Anon_Id intrinsic before calling Analyze_Instance_And_Renamings because this flag may be propagated to other nodes. --17pEHd4RhPHOinZp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -5796,6 +5796,14 @@ package body Sem_Ch12 is Set_SPARK_Mode (Gen_Unit); end if; + -- Need to mark Anon_Id intrinsic before calling + -- Analyze_Instance_And_Renamings because this flag may be propagated + -- to other nodes. + + if Is_Intrinsic_Subprogram (Gen_Unit) then + Set_Is_Intrinsic_Subprogram (Anon_Id); + end if; + Analyze_Instance_And_Renamings; -- Restore SPARK_Mode from the context after analysis of the package @@ -5817,7 +5825,6 @@ package body Sem_Ch12 is -- not within the main unit. if Is_Intrinsic_Subprogram (Gen_Unit) then - Set_Is_Intrinsic_Subprogram (Anon_Id); Set_Is_Intrinsic_Subprogram (Act_Decl_Id); if Chars (Gen_Unit) = Name_Unchecked_Conversion then --17pEHd4RhPHOinZp--