From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id AC4733856DEA for ; Mon, 26 Sep 2022 09:15:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AC4733856DEA 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-wm1-x329.google.com with SMTP id o5so4043035wms.1 for ; Mon, 26 Sep 2022 02:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=ZTvPvX3wRN9CxWTpXWvYV690mBi8SjylwSckzrRc9Ic=; b=D5tsY0JbZCpo9TUpIkAzHmeeDKrjyjK8HHLbZNKZqqTzVquSQbEktQQ231ibgElXWI Nx+0kngpY63dZb+LWdyIb0zIRZ5GMdbPiqwwwUqwdaWo3tG6O/2zjVDc7sWujs2IrmZq i+AcEwpcStJP8Ade8HTbjP93Dfi0F7ilbGMb4q3Pbo9Lk30zDn4NrwsRkEpMRBo0jqOW nHeU+ugBwdT4mSmI8bPP9J/PR4APTWFe4McJ1lYFUudE5tFy8Js84zaCDUxi+KHO2Qmd jztqeL2QWJSrGiI5NuoEVW0rSjWdEIVpZ15rAGOrHRf/W4BKxMQ7W/RHH1NR7wTH1pfq 32Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=ZTvPvX3wRN9CxWTpXWvYV690mBi8SjylwSckzrRc9Ic=; b=3vdFWC7gi6N3a96qIlEVkmJo6uyCSmM5sqkApfSlSwalJvGC/sdHQkQS9VbDyBMhH5 8a2aflzYFEYvPYncFlvPIUzF+XmFd4Bt6efD+sMrfgCPQ1zGdGpo8P6IJ0AX+shKLY8G TcNLvPypR6QuhWAq3ikNAr6HGh1BhQskvEKSF7jCpiM4zKKft+NoJaUpv2BdBRWs0K7d r0hN7lQxXco7XxXG4HZDjsxFWLQesjXufCBn6uAaRS+x87qn6GstezHYg+JoZU7GrxIX A8QRBSxSAL+zKBM6aCrSEqSQ66DwO4oFKiiJWzIy84QZd3Lx/FdgbcCHDE/nPfA1Svmo 2SdA== X-Gm-Message-State: ACrzQf2HBJOAYUZPwnoswnGVIDcVZDz54XhihBF21wG2k/OtOWO8d7fr ZMG0nNOutc1hd5uxVHv3dAaVUwN3Cl8QnA== X-Google-Smtp-Source: AMsMyM7wFVIeCcGaqQlUsL85wTlqdi2hqAWJTMsS3GMleE7fiFNbK266l9ybMkefKtdSfnVkF1d21A== X-Received: by 2002:a05:600c:5254:b0:3b5:99c:9be1 with SMTP id fc20-20020a05600c525400b003b5099c9be1mr12110668wmb.172.1664183745576; Mon, 26 Sep 2022 02:15:45 -0700 (PDT) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id p12-20020a05600c358c00b003b482fbd93bsm10759780wmq.24.2022.09.26.02.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 02:15:45 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITED] ada: Fix location of pragmas coming from aspects in top-level instances Date: Mon, 26 Sep 2022 11:15:42 +0200 Message-Id: <20220926091542.273909-1-poulhies@adacore.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.1 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Piotr Trojanek This patch fixes an AST anomaly where pragmas that correspond to aspects of a generic package declaration appeared as the auxiliary declarations of the compilation unit for the instantiated package body. In particular, this anomaly happened for aspect Annotate and affected GNATprove, which didn't pick pragma corresponding to this aspect. gcc/ada/ * sem_ch12.adb (Build_Instance_Compilation_Unit_Nodes): Relocate auxiliary declarations from the original compilation unit to the newly created compilation unit for the spec. --- gcc/ada/sem_ch12.adb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 9525140b45b..ab2e1825679 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -6296,13 +6296,16 @@ package body Sem_Ch12 is Old_Main : constant Entity_Id := Cunit_Entity (Main_Unit); begin - -- A new compilation unit node is built for the instance declaration + -- A new compilation unit node is built for the instance declaration. + -- It relocates the auxiliary declaration node from the compilation unit + -- where the instance appeared, so that declarations that originally + -- followed the instance will be attached to the spec compilation unit. Decl_Cunit := Make_Compilation_Unit (Sloc (N), Context_Items => Empty_List, Unit => Act_Decl, - Aux_Decls_Node => Make_Compilation_Unit_Aux (Sloc (N))); + Aux_Decls_Node => Relocate_Node (Aux_Decls_Node (Parent (N)))); Set_Parent_Spec (Act_Decl, Parent_Spec (N)); -- 2.25.1