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 658413858422 for ; Thu, 15 Jun 2023 08:03:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 658413858422 Authentication-Results: sourceware.org; dmarc=pass (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 2adb3069b0e04-4f004cc54f4so10086901e87.3 for ; Thu, 15 Jun 2023 01:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1686816233; x=1689408233; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ALbQXf7rFjieqyEOmr393YC90foVJxqo284ya8800Lo=; b=XZ5qNXUdDf2y3bfvTvH4RJkqodpnkH23MfkKHKT1pKVInZt6NC1Od9A93o5qwUElc+ 77FMwu/lCBxJICdMCgxALrhrgiOu9Rvq5qabqf0UlAzFzP4lFfAo4qpdpTUKvx5CZgg1 LEZyxHGo0h86qZpZfUMNNqqtl1I4PP+9L10tLheNEICmDWiV4UdZZAB0UvZslHKEdC+J nyCaHeoXzq7wYPV7UQJnKXMcBjSttQ8zIHgiTdcfRFC4tc39PY6EIhsh98m7u5iC8OyQ Z+/+yjyCBdzpRUzrGhWFoNYbh8jAwW2DJC4Mt9BqZrjEVbZr/GbPKKUtLE9GnMNIZGMw eK4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686816233; x=1689408233; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ALbQXf7rFjieqyEOmr393YC90foVJxqo284ya8800Lo=; b=ESZt89JSLnjJ2oA+VNLkrv6l/mfiKyXzvjYPl50D403o21sp6Fy4KQ3qjFX7ASxOWG 30lRf9qicMiUGRSEeY9cUtLxQWAdkReBCUCR7x76fJQwpMSSphp/q78FqIIrziKU/nXs 4qyhdA1omdOzP1ltVsI5+6ZfxAgUF/c6K+L3UM+WrcCaqt9608pnBd+fRkQP0n+vLSFQ c6uOGYR8jS29i/Xgzk/8cDeKG3Bw2gNnhI2ljYfZ263mKerLUv8mNdtfo7txzxR1UANa Jix5AFLZFykXpIi9KCN6w4fr6iQmeDzHtP9VTiUjCuNPuAQsR+mwmlkXzk9+ey52XuyR kFSQ== X-Gm-Message-State: AC+VfDwvrNW80wgfvLLyNBnKjL3RddSUyl7v7Cw+zmr+NaAQX0erZsmQ g7oc2ieEloDJCqBo20noqz91cooV6Fd9YKgEDJA2jQ== X-Google-Smtp-Source: ACHHUZ6QAnraJGMWsdtndpSELx735+BC1LxIAMpU40kTWwxA2tmzY3fUIXOcmd8JrBDSjQb20MXvWw== X-Received: by 2002:a19:8c53:0:b0:4f7:d2af:3ed1 with SMTP id i19-20020a198c53000000b004f7d2af3ed1mr1490655lfj.42.1686816232738; Thu, 15 Jun 2023 01:03:52 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id u26-20020a05600c00da00b003eddc6aa5fasm19782656wmm.39.2023.06.15.01.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 01:03:52 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix aspect Linker_Section ignored on subprogram body Date: Thu, 15 Jun 2023 10:03:51 +0200 Message-Id: <20230615080351.938791-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Eric Botcazou The compiler is waiting for the freeze node of the body, but it is never generated since the freezing of the body is not delayed. The change also removes an obsolete piece of code. gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Specifications): Add missing items in the list of aspects handled by means of Insert_Pragma. : Remove obsolete code. Do not delay the processing of the aspect if the entity is already frozen. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch13.adb | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index e771c0d2020..65627321ffe 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1409,20 +1409,37 @@ package body Sem_Ch13 is -- Abstract_State -- Always_Terminates -- Attach_Handler + -- Async_Readers + -- Async_Writers + -- Constant_After_Elaboration -- Contract_Cases + -- Convention + -- Default_Initial_Condition + -- Default_Storage_Pool -- Depends + -- Effective_Reads + -- Effective_Writes -- Exceptional_Cases + -- Extensions_Visible -- Ghost -- Global -- Initial_Condition -- Initializes + -- Max_Entry_Queue_Depth + -- Max_Entry_Queue_Length + -- Max_Queue_Length + -- No_Caching + -- Part_Of -- Post -- Pre -- Refined_Depends -- Refined_Global + -- Refined_Post -- Refined_State -- SPARK_Mode + -- Secondary_Stack_Size -- Subprogram_Variant + -- Volatile_Function -- Warnings -- Insert pragma Prag such that it mimics the placement of a source -- pragma of the same kind. Flag Is_Generic should be set when the @@ -3064,16 +3081,11 @@ package body Sem_Ch13 is Expression => Relocate_Node (Expr))), Pragma_Name => Name_Linker_Section); - -- Linker_Section does not need delaying, as its argument - -- must be a static string. Furthermore, if applied to - -- an object with an explicit initialization, the object - -- must be frozen in order to elaborate the initialization - -- code. (This is already done for types with implicit - -- initialization, such as protected types.) + -- No need to delay the processing if the entity is already + -- frozen. This should only happen for subprogram bodies. - if Nkind (N) = N_Object_Declaration - and then Has_Init_Expression (N) - then + if Is_Frozen (E) then + pragma Assert (Nkind (N) = N_Subprogram_Body); Delay_Required := False; end if; @@ -4763,9 +4775,7 @@ package body Sem_Ch13 is -- For an aspect that applies to a type, indicate whether it -- appears on a partial view of the type. - if Is_Type (E) - and then Is_Private_Type (E) - then + if Is_Type (E) and then Is_Private_Type (E) then Set_Aspect_On_Partial_View (Aspect); end if; -- 2.40.0