summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/atomic6_7.adb
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-10 19:45:17 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-10 19:45:17 +0000
commitf2bd5d546797abaf99d7cafb6add5003ff733ff3 (patch)
tree5894e158f9de464a9516a560a37795fd3caeab43 /gcc/testsuite/gnat.dg/atomic6_7.adb
parent022a1701c4517308af026c64c707883358b37f26 (diff)
downloadgcc-f2bd5d546797abaf99d7cafb6add5003ff733ff3.tar.gz
* fe.h (Serious_Errors_Detected): New macro.
* gcc-interface/gigi.h (build_atomic_load): Declare. (build_atomic_store): Likewise. * gcc-interface/trans.c (atomic_sync_required_p): New predicate. (call_to_gnu): Add ATOMIC_SYNC parameter. Use local variable. Build an atomic load for an In or In Out parameter if needed. Build an atomic store for the assignment of an Out parameter if needed. Build an atomic store to the target if ATOMIC_SYNC is true. (present_in_lhs_or_actual_p): New predicate. (gnat_to_gnu) <N_Identifier>: Build an atomic load if needed. <N_Explicit_Dereference>: Likewise. <N_Indexed_Component>: Likewise. <N_Selected_Component>: Likewise. <N_Assignment_Statement>: Adjust call to call_to_gnu. Build an atomic store to the LHS if needed. <N_Function_Call>: Adjust call to call_to_gnu. * gcc-interface/utils2.c: Include toplev.h. (resolve_atomic_size): New static function. (build_atomic_load): New function. (build_atomic_store): Likewise. * gcc-interface/Make-lang.in (ada/utils2.o): Add toplev.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181267 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gnat.dg/atomic6_7.adb')
-rw-r--r--gcc/testsuite/gnat.dg/atomic6_7.adb40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/atomic6_7.adb b/gcc/testsuite/gnat.dg/atomic6_7.adb
new file mode 100644
index 00000000000..8b48bf5165d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/atomic6_7.adb
@@ -0,0 +1,40 @@
+-- { dg-do compile }
+-- { dg-options "-fdump-tree-gimple" }
+
+with Atomic6_Pkg; use Atomic6_Pkg;
+
+procedure Atomic6_7 is
+ My_Atomic : R;
+ Temp : Integer;
+begin
+
+ My_Atomic.Counter1 := Counter2;
+
+ My_Atomic.Timer1 := Timer2;
+
+ My_Atomic.Counter1 := Int(My_Atomic.Timer1);
+ My_Atomic.Timer1 := Integer(My_Atomic.Counter1);
+
+ Temp := Integer(My_Atomic.Counter1);
+ My_Atomic.Counter1 := Int(Temp);
+
+ Temp := My_Atomic.Timer1;
+ My_Atomic.Timer1 := Temp;
+
+end;
+
+-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&my_atomic.counter1" 2 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter2" 1 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&my_atomic.timer1" 2 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer2" 1 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*ptr" 0 "gimple"} }
+
+-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&my_atomic.counter1" 3 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter2" 0 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&my_atomic.timer1" 3 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer2" 0 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} }
+-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*ptr" 0 "gimple"} }
+
+-- { dg-final { cleanup-tree-dump "gimple" } }