public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5016] [Ada] Guard against illegal items in Global but not Depends
Date: Tue,  9 Nov 2021 09:45:29 +0000 (GMT)	[thread overview]
Message-ID: <20211109094529.73318385842F@sourceware.org> (raw)

https://gcc.gnu.org/g:9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd

commit r12-5016-g9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Mon Oct 25 16:33:24 2021 +0200

    [Ada] Guard against illegal items in Global but not Depends
    
    gcc/ada/
    
            * sem_prag.adb (Check_Usage): Guard against calling Usage_Error
            with illegal Item_Id. The intention to do this was already
            described in the comment but not implemented.

Diff:
---
 gcc/ada/sem_prag.adb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 10ad82fd8a4..1c048145bb4 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -1684,7 +1684,15 @@ package body Sem_Prag is
                --  States and global objects are not used properly only when
                --  the subprogram is subject to pragma Global.
 
-               elsif Global_Seen then
+               elsif Global_Seen
+                 and then Ekind (Item_Id) in E_Abstract_State
+                                           | E_Constant
+                                           | E_Loop_Parameter
+                                           | E_Protected_Type
+                                           | E_Task_Type
+                                           | E_Variable
+                                           | Formal_Kind
+               then
                   Usage_Error (Item_Id);
                end if;
             end if;


                 reply	other threads:[~2021-11-09  9:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211109094529.73318385842F@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).