aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-12-22 01:06:31 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-05-04 05:17:30 -0400
commitc356dfdd6fb75553d010852b0a801c9e780290e8 (patch)
tree5124b3a0485870e3352510c6014bb1b882295e6a /gcc
parent98a54aa50496f5c403ad34e5ef4e758945666be5 (diff)
downloadgcc-c356dfdd6fb75553d010852b0a801c9e780290e8.zip
gcc-c356dfdd6fb75553d010852b0a801c9e780290e8.tar.gz
gcc-c356dfdd6fb75553d010852b0a801c9e780290e8.tar.bz2
[Ada] Reject formals of mode IN appearing as global outputs
gcc/ada/ * sem_prag.adb (Check_Mode_Restriction_In_Enclosing_Context): Apply the rule even with no explicit Global contract (and remove a dead condition for Refined_Global).
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_prag.adb14
1 files changed, 5 insertions, 9 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index b13894c..86a9754 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -2634,13 +2634,9 @@ package body Sem_Prag is
Context := Anonymous_Object (Context);
end if;
- if (Is_Subprogram_Or_Entry (Context)
- or else Ekind (Context) = E_Task_Type
- or else Is_Single_Task_Object (Context))
- and then
- (Present (Get_Pragma (Context, Pragma_Global))
- or else
- Present (Get_Pragma (Context, Pragma_Refined_Global)))
+ if Is_Subprogram_Or_Entry (Context)
+ or else Ekind (Context) = E_Task_Type
+ or else Is_Single_Task_Object (Context)
then
Collect_Subprogram_Inputs_Outputs
(Subp_Id => Context,
@@ -2649,8 +2645,8 @@ package body Sem_Prag is
Global_Seen => Dummy);
-- The item is classified as In_Out or Output but appears as
- -- an Input in an enclosing subprogram or task unit (SPARK
- -- RM 6.1.4(13)).
+ -- an Input or a formal parameter of mode IN in an enclosing
+ -- subprogram or task unit (SPARK RM 6.1.4(13)).
if Appears_In (Inputs, Item_Id)
and then not Appears_In (Outputs, Item_Id)