public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Check entries for formals of mode IN appearing as global outputs
@ 2021-05-04  9:52 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-04  9:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 338 bytes --]

Rule SPARK RM 6.1.4(13) only mentions "subprograms", but it is equally
applicable to protected entries whose global inputs cannot appear as
global outputs in nested subprograms.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_prag.adb (Check_Mode_Restriction_In_Enclosing_Context):
	Extend check to protected entries.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 958 bytes --]

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -2634,7 +2634,7 @@ package body Sem_Prag is
                   Context := Anonymous_Object (Context);
                end if;
 
-               if (Is_Subprogram (Context)
+               if (Is_Subprogram_Or_Entry (Context)
                      or else Ekind (Context) = E_Task_Type
                      or else Is_Single_Task_Object (Context))
                  and then
@@ -2659,7 +2659,7 @@ package body Sem_Prag is
                        ("global item & cannot have mode In_Out or Output",
                         Item, Item_Id);
 
-                     if Is_Subprogram (Context) then
+                     if Is_Subprogram_Or_Entry (Context) then
                         SPARK_Msg_NE
                           (Fix_Msg (Subp_Id, "\item already appears as input "
                            & "of subprogram &"), Item, Context);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-04  9:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04  9:52 [Ada] Check entries for formals of mode IN appearing as global outputs Pierre-Marie de Rodat

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).