summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-06 08:26:50 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-06 08:26:50 +0000
commit221e68f2b80e1f0910e949a7dff2be19404c1f86 (patch)
tree205548c01d5a82a1eb2ad023bb2bc6958fb4417e /libgomp/testsuite/libgomp.c++
parent2c56f72e68d87740221d011a8ef2e19b599fa3c3 (diff)
downloadgcc-221e68f2b80e1f0910e949a7dff2be19404c1f86.tar.gz
PR c++/33894
* cp-tree.h: Update comment - TYPE_LANG_FLAG_0 is not OMP_ATOMIC_DEPENDENT_P in OMP_ATOMIC. * pt.c (tsubst_expr): Assert OMP_ATOMIC_DEPENDENT_P. * semantics.c (finish_omp_atomic): Revert most of the 2007-02-05 changes, just keep the new representation of OMP_ATOMIC_DEPENDENT_P OMP_ATOMIC. * testsuite/libgomp.c++/atomic-1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129919 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/testsuite/libgomp.c++')
-rw-r--r--libgomp/testsuite/libgomp.c++/atomic-1.C53
1 files changed, 53 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c++/atomic-1.C b/libgomp/testsuite/libgomp.c++/atomic-1.C
new file mode 100644
index 00000000000..73f6e7c4059
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/atomic-1.C
@@ -0,0 +1,53 @@
+// PR c++/33894
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+
+int check;
+
+template<typename T> void
+foo ()
+{
+ #pragma omp atomic
+ check |= sizeof (T);
+}
+
+template<typename T> void
+bar (T *x, T y)
+{
+ #pragma omp atomic
+ *x += y;
+}
+
+template<typename T> void
+baz ()
+{
+ #pragma omp atomic
+ check++;
+}
+
+int
+main ()
+{
+ int i = 0;
+ long l = 0;
+
+ check = 0;
+ foo<char> ();
+ if (check != sizeof (char))
+ abort ();
+ foo<short> ();
+ if (check != (sizeof (char) | sizeof (short)))
+ abort ();
+ bar(&i, 4);
+ bar(&l, 8L);
+ if (i != 4 || l != 8L)
+ abort ();
+ baz<char> ();
+ if (check != (sizeof (char) | sizeof (short)) + 1)
+ abort ();
+ baz<long double> ();
+ if (check != (sizeof (char) | sizeof (short)) + 2)
+ abort ();
+}