From 431e762fae0faf10c6a115cd4e36d7c8867c5c17 Mon Sep 17 00:00:00 2001 From: Yannick Moy Date: Wed, 11 Dec 2019 17:39:07 +0100 Subject: [PATCH] [Ada] Fix spurious error on checking of null Abstract_State 2020-05-25 Yannick Moy gcc/ada/ * sem_util.adb (Check_No_Hidden_State): Stop propagation at first block/task/entry. --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/sem_util.adb | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7c8af5f8387..4e1b34d2aec 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2020-05-25 Yannick Moy + + * sem_util.adb (Check_No_Hidden_State): Stop propagation at + first block/task/entry. + 2020-05-25 Yannick Moy * doc/gnat_rm/implementation_defined_pragmas.rst: Document diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index e1703e995f1..b980b4c63fd 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -3387,10 +3387,14 @@ package body Sem_Util is return; -- Objects and states that appear immediately within a subprogram or - -- inside a construct nested within a subprogram do not introduce a - -- hidden state. They behave as local variable declarations. + -- entry inside a construct nested within a subprogram do not + -- introduce a hidden state. They behave as local variable + -- declarations. The same is true for elaboration code inside a block + -- or a task. - elsif Is_Subprogram (Context) then + elsif Is_Subprogram_Or_Entry (Context) + or else Ekind_In (Context, E_Block, E_Task_Type) + then return; -- When examining a package body, use the entity of the spec as it -- 2.30.2