Message ID | 20230526073618.2068882-1-poulhies@adacore.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp294008vqr; Fri, 26 May 2023 00:50:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7yUjjJkngY5gDGU9i7U4nhSa9i3AI51zI2yY94fB/dVti4lBEotJTgMtwfMQQhRT8vTluf X-Received: by 2002:a17:907:708:b0:96a:4f89:3916 with SMTP id xb8-20020a170907070800b0096a4f893916mr1076015ejb.58.1685087419483; Fri, 26 May 2023 00:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685087419; cv=none; d=google.com; s=arc-20160816; b=MN/3KJSQsyynaeKpBjFfKEHe5Z42kQ3V1ofgj9qFPow5J8Hjlh4m5QRZLvfbZRGdun higOoxm+e2rv34YDBEslWEmGqKT8H660ImirfH3SHuWZMxy/sYIXfhwE3cQdW1BE1elV I24wW25wuJVvcgkdrJ/Acj9ORDhD61ZWjKvw5T93MJaStNDeEffvhS7+5J1cxZ9Kjz1E NNkBVW7ats8WsnLCOsvo78Bf9WqJh3radIZyyPZPz4aoswpuItkF5ztx0bEU7kOufwHR o7eZWNiD/1qnYJEtucKyhx9u0SXojacidwk5oahS91UASg5V8fblwn6gwmh5pYpJW1hg Qpkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=mbnNMXVnWwpEy2GGFK/jBBwbtS/Ps6DdWFR1u9UJhUo=; b=mKbhVN5z2xrLYRG0QneDMFddvtIsIB3NL2DbUk/Lz+3Y2DMmKOGP4wbPQeM+q+Iekk MfhtHvep6zl2Sj2U9+JIbZGT5RdI93qA4Hw4KOdD4BHCwxkz+hHrZIiOgfFy7cKrn6/b dLwbN9YL2LN2xySbMlAq2CMtl0W2if0YMYHlkloAbqVp6rrIKW/E4h7pEEIL4nTAJKVr sT8L7nH59S07JF6QZmHjonqsU79C5t5u8iaM4acim3ZVTAZC6VWnkbdJ1uxJeIxgrKLc K46dDUf2z41UVwRYf00XivLWjXFrynAWgFhYibozHR3cSOvIJStsTCPahUe91s0yHb9h v2mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=coQRyAps; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ho18-20020a1709070e9200b0096552e0fce6si441743ejc.360.2023.05.26.00.50.19 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:50:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=coQRyAps; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BBF30396D839 for <ouuuleilei@gmail.com>; Fri, 26 May 2023 07:42:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBF30396D839 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685086947; bh=mbnNMXVnWwpEy2GGFK/jBBwbtS/Ps6DdWFR1u9UJhUo=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=coQRyApsUB+35OQWn7i/anFapLfZ6LCFqOTwnpTZfWEnsjs7r2foAi03w8jKoy4Q1 SGFRAFwgsrhNYJVASXbGf7yHpN7jq9wZYMhyKhCF3z2ZLm5cQ/8HEgCBrZdiGTtb1K ZW8EvUWbmNElZLoaFdk1zMmeqF754n5ilac2/b2E= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 7FE843836E87 for <gcc-patches@gcc.gnu.org>; Fri, 26 May 2023 07:36:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7FE843836E87 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3078d1c8828so341764f8f.3 for <gcc-patches@gcc.gnu.org>; Fri, 26 May 2023 00:36:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685086580; x=1687678580; 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=mbnNMXVnWwpEy2GGFK/jBBwbtS/Ps6DdWFR1u9UJhUo=; b=P6ZwBY/TDrYJ1TUPcWLfgVRiPI9Foqj6SZ4f3FR3mkVb6jaKQyETCnXLIFOzFiXXHh 9tg/hx02oNFbuhr9P4WlyGTGIItXi6B/PmuOW9ULE/ETsQDAFl81scADhDmksI1oUVNM wgwmlkhRZLWupOFQgUm1AAWn3uMn+UlQDa9Ya5Jo3Yv6hKZFhxaQ4IgQhpj+kNvLuidz k2hWD8m06bDZfjZOetac0x+8cvjBvKz6DL/BkxJfGeWWc15zXpMvhvx47OeLTC1qgNlq MTwLVdS66hGSr274OLvXaYJ49c1I1irN0fvwYCcU2FiDl+wDswnpJJbM8ykzGbg2Fydh k3vQ== X-Gm-Message-State: AC+VfDyaFCKzBx52hIOpQFYWghs9bK3AvflP8qViDTBfTHhITSzYi3/w ptbFABKUrm8+fup5CYWqRd/ER2hxVg9LBEwhNFrnBg== X-Received: by 2002:a05:6000:4e3:b0:309:ccad:b2fb with SMTP id cr3-20020a05600004e300b00309ccadb2fbmr685326wrb.5.1685086580376; Fri, 26 May 2023 00:36:20 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:777b:eef4:6f79:f26f]) by smtp.gmail.com with ESMTPSA id m19-20020a7bcb93000000b003f605566610sm7956426wmi.13.2023.05.26.00.36.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:36:19 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek <trojanek@adacore.com> Subject: [COMMITTED] ada: Fix handling of Global contracts inside generic subprograms Date: Fri, 26 May 2023 09:36:18 +0200 Message-Id: <20230526073618.2068882-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.6 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= <gcc-patches@gcc.gnu.org> Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766942226294637650?= X-GMAIL-MSGID: =?utf-8?q?1766942226294637650?= |
Series |
[COMMITTED] ada: Fix handling of Global contracts inside generic subprograms
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Marc Poulhiès
May 26, 2023, 7:36 a.m. UTC
From: Piotr Trojanek <trojanek@adacore.com>
Routine Get_Argument works differently for generic units (as explained
in its comment), but it failed to reliably detect such units when their
kind is temporarily made non-generic (for resolving recursive calls, as
explained in the comment at the end of Is_Generic_Declaration_Or_Body).
With this patch the frontend will look at the decorated expression of
the Global contract attached to the Global aspect; previously it was
looking at the undecorated expression attached to the corresponding
pragma.
gcc/ada/
* sem_prag.adb (Get_Argument): Improve detection of generic units.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_prag.adb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index d66e5612135..96ea17209f3 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -31650,7 +31650,9 @@ package body Sem_Prag is -- to save the global references in the generic context. if From_Aspect_Specification (Prag) - and then (Present (Context_Id) and then Is_Generic_Unit (Context_Id)) + and then Present (Context_Id) + and then + Is_Generic_Declaration_Or_Body (Unit_Declaration_Node (Context_Id)) then return Corresponding_Aspect (Prag);