summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/appendix-a/a.17.2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/gomp/appendix-a/a.17.2.c')
-rw-r--r--gcc/testsuite/gcc.dg/gomp/appendix-a/a.17.2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gomp/appendix-a/a.17.2.c b/gcc/testsuite/gcc.dg/gomp/appendix-a/a.17.2.c
new file mode 100644
index 00000000000..aaaec7ea351
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/appendix-a/a.17.2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+void
+a17_2_wrong ()
+{
+ int x;
+ int *i;
+ float *r;
+ i = &x;
+ r = (float *) &x;
+#pragma omp parallel
+ {
+#pragma omp atomic
+ *i += 1;
+#pragma omp atomic
+ *r += 1.0;
+/* Incorrect because the atomic constructs reference the same location
+ through incompatible types */
+ }
+}