aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/pr39591-3.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-04-01 08:54:52 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-04-01 08:54:52 +0200
commit03742a9b0159abadf88dc259d1331b48cf102e73 (patch)
tree21d252b6e42e3b03c7ed6cbdf149f1b4814d94fc /libgomp/testsuite/libgomp.c/pr39591-3.c
parent4223ff5f252b650b7e799d7e919bbc1796901aed (diff)
downloadgcc-03742a9b0159abadf88dc259d1331b48cf102e73.zip
gcc-03742a9b0159abadf88dc259d1331b48cf102e73.tar.gz
gcc-03742a9b0159abadf88dc259d1331b48cf102e73.tar.bz2
re PR other/39591 (GOMP_loop_end illegally optmized into GOMP_loop_end_nowait)
PR other/39591 * omp-low.c (remove_exit_barrier): Don't optimize if there are any addressable variables in the parallel that could go out of scope while running queued tasks. * testsuite/libgomp.c/pr39591-1.c: New test. * testsuite/libgomp.c/pr39591-2.c: New test. * testsuite/libgomp.c/pr39591-3.c: New test. From-SVN: r145390
Diffstat (limited to 'libgomp/testsuite/libgomp.c/pr39591-3.c')
-rw-r--r--libgomp/testsuite/libgomp.c/pr39591-3.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/pr39591-3.c b/libgomp/testsuite/libgomp.c/pr39591-3.c
new file mode 100644
index 0000000..a9aeea7
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr39591-3.c
@@ -0,0 +1,40 @@
+/* PR other/39591 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+int err, a[40];
+
+void __attribute__((noinline))
+foo (int *array)
+{
+#pragma omp task
+ {
+ int j;
+ for (j = 0; j < sizeof array / sizeof array[0]; j++)
+ if (array[j] != 0x55555555)
+#pragma omp atomic
+ err++;
+ }
+}
+
+int
+main (void)
+{
+ int k;
+ for (k = 0; k < sizeof a / sizeof a[0]; k++)
+ a[k] = 0x55555555;
+
+#pragma omp parallel
+ {
+ int i;
+
+#pragma omp for schedule (dynamic)
+ for (i = 0; i < 50; i++)
+ foo (a);
+ }
+ if (err)
+ abort ();
+ return 0;
+}