aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_util.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_util.adb')
-rw-r--r--gcc/ada/exp_util.adb28
1 files changed, 20 insertions, 8 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 8ac1b90..45eb808 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -8228,19 +8228,31 @@ package body Exp_Util is
return;
end if;
- -- the expansion of Task and protected type declarations can
+ -- The expansion of task and protected type declarations can
-- create declarations for temporaries which, like other actions
- -- are inserted and analyzed before the current declaraation.
- -- However, the current scope is the synchronized type, and
- -- for unnesting it is critical that the proper scope for these
- -- generated entities be the enclosing one.
+ -- are inserted and analyzed before the current declaration.
+ -- However, in some cases, the current scope is the synchronized
+ -- type, and for unnesting it is critical that the proper scope
+ -- for these generated entities be the enclosing one.
when N_Task_Type_Declaration
| N_Protected_Type_Declaration =>
- Push_Scope (Scope (Current_Scope));
- Insert_List_Before_And_Analyze (P, Ins_Actions);
- Pop_Scope;
+ declare
+ Skip_Scope : constant Boolean :=
+ Ekind (Current_Scope) in Concurrent_Kind;
+ begin
+ if Skip_Scope then
+ Push_Scope (Scope (Current_Scope));
+ end if;
+
+ Insert_List_Before_And_Analyze (P, Ins_Actions);
+
+ if Skip_Scope then
+ Pop_Scope;
+ end if;
+ end;
+
return;
-- A special case, N_Raise_xxx_Error can act either as a statement