summaryrefslogtreecommitdiffstats
path: root/gcc/ada/exp_ch2.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-04 10:58:44 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-04 10:58:44 +0000
commit31c965795756c0367c18f4085e1dc81d82989c67 (patch)
tree4fb7d2b99ab6a632f2c8d21830170c4d8019ef8f /gcc/ada/exp_ch2.adb
parentb4ff05bc874d61d31fb91f818eeb288aa5ee9f83 (diff)
downloadppe42-gcc-31c965795756c0367c18f4085e1dc81d82989c67.tar.gz
ppe42-gcc-31c965795756c0367c18f4085e1dc81d82989c67.zip
2011-11-04 Robert Dewar <dewar@adacore.com>
* exp_ch2.adb (Expand_Entity_Reference): Extend handling of atomic sync to type case. * sem_prag.adb (Process_Suppress_Unsuppress): Atomic Sync can apply to types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180938 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch2.adb')
-rw-r--r--gcc/ada/exp_ch2.adb23
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb
index a71ce69602e..24f47a7775b 100644
--- a/gcc/ada/exp_ch2.adb
+++ b/gcc/ada/exp_ch2.adb
@@ -401,7 +401,9 @@ package body Exp_Ch2 is
-- Set Atomic_Sync_Required if necessary for atomic variable
- if Is_Atomic (E) then
+ if Nkind_In (N, N_Identifier, N_Expanded_Name)
+ and then (Is_Atomic (E) or else Is_Atomic (Etype (E)))
+ then
declare
Set : Boolean;
MLoc : Node_Id;
@@ -417,10 +419,25 @@ package body Exp_Ch2 is
elsif Debug_Flag_Dot_D then
Set := False;
- -- Otherwise setting comes from Atomic_Synchronization state
+ -- If variable is atomic, but type is not, setting depends on
+ -- disable/enable state for the variable.
- else
+ elsif Is_Atomic (E) and then not Is_Atomic (Etype (E)) then
Set := not Atomic_Synchronization_Disabled (E);
+
+ -- If variable is not atomic, but its type is atomic, setting
+ -- depends on disable/enable state for the type.
+
+ elsif not Is_Atomic (E) and then Is_Atomic (Etype (E)) then
+ Set := not Atomic_Synchronization_Disabled (Etype (E));
+
+ -- Else both variable and type are atomic (see outer if), and we
+ -- disable if either variable or its type have sync disabled.
+
+ else
+ Set := (not Atomic_Synchronization_Disabled (E))
+ and then
+ (not Atomic_Synchronization_Disabled (Etype (E)));
end if;
-- Set flag if required
OpenPOWER on IntegriCloud