aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-07-29 19:45:42 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2011-07-29 19:45:42 +0200
commit2514265077f4260ae10377791317c6754b3292df (patch)
treecc238d8f70d98c37fa0b8f86e59aeaeb9dd01f24 /libgomp
parent8984005841121ca4d6336da74d64e5ebe89ab5ea (diff)
re PR middle-end/49897 (nesting lastprivate gives incorrect result)
PR middle-end/49897 PR middle-end/49898 * omp-low.c (use_pointer_for_field): If disallowing copy-in/out in nested parallel and outer is a gimple_reg, mark it as addressable and set its bit in task_shared_vars bitmap too. * testsuite/libgomp.c/pr49897-1.c: New test. * testsuite/libgomp.c/pr49897-2.c: New test. * testsuite/libgomp.c/pr49898-1.c: New test. * testsuite/libgomp.c/pr49898-2.c: New test. From-SVN: r176945
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog9
-rw-r--r--libgomp/testsuite/libgomp.c/pr49897-1.c31
-rw-r--r--libgomp/testsuite/libgomp.c/pr49897-2.c25
-rw-r--r--libgomp/testsuite/libgomp.c/pr49898-1.c26
-rw-r--r--libgomp/testsuite/libgomp.c/pr49898-2.c18
5 files changed, 109 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 19c88fbb8fb..292d58a570b 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,12 @@
+2011-07-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/49897
+ PR middle-end/49898
+ * testsuite/libgomp.c/pr49897-1.c: New test.
+ * testsuite/libgomp.c/pr49897-2.c: New test.
+ * testsuite/libgomp.c/pr49898-1.c: New test.
+ * testsuite/libgomp.c/pr49898-2.c: New test.
+
2011-07-28 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/lib/libgomp.exp (libgomp_init): Add -march=i486
diff --git a/libgomp/testsuite/libgomp.c/pr49897-1.c b/libgomp/testsuite/libgomp.c/pr49897-1.c
new file mode 100644
index 00000000000..d21a26252b9
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr49897-1.c
@@ -0,0 +1,31 @@
+/* PR middle-end/49897 */
+/* { dg-do run } */
+
+extern void abort (void);
+
+int
+main ()
+{
+ int i, j, x = 0, y, sum = 0;
+#pragma omp parallel reduction(+:sum)
+ {
+ #pragma omp for firstprivate(x) lastprivate(x, y)
+ for (i = 0; i < 10; i++)
+ {
+ x = i;
+ y = 0;
+ #pragma omp parallel reduction(+:sum)
+ {
+ #pragma omp for firstprivate(y) lastprivate(y)
+ for (j = 0; j < 10; j++)
+ {
+ y = j;
+ sum += y;
+ }
+ }
+ }
+ }
+ if (x != 9 || y != 9 || sum != 450)
+ abort ();
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/pr49897-2.c b/libgomp/testsuite/libgomp.c/pr49897-2.c
new file mode 100644
index 00000000000..c9ea5eced86
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr49897-2.c
@@ -0,0 +1,25 @@
+/* PR middle-end/49897 */
+/* { dg-do run } */
+
+extern void abort (void);
+
+int
+main ()
+{
+ int i, j, x = 0, y, sum = 0;
+#pragma omp parallel for reduction(+:sum) firstprivate(x) lastprivate(x, y)
+ for (i = 0; i < 10; i++)
+ {
+ x = i;
+ y = 0;
+ #pragma omp parallel for reduction(+:sum) firstprivate(y) lastprivate(y)
+ for (j = 0; j < 10; j++)
+ {
+ y = j;
+ sum += y;
+ }
+ }
+ if (x != 9 || y != 9 || sum != 450)
+ abort ();
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/pr49898-1.c b/libgomp/testsuite/libgomp.c/pr49898-1.c
new file mode 100644
index 00000000000..175426d4000
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr49898-1.c
@@ -0,0 +1,26 @@
+/* PR middle-end/49898 */
+/* { dg-do run } */
+
+extern void abort (void);
+
+int
+main ()
+{
+ int i, j, sum = 0;
+#pragma omp parallel
+ {
+ #pragma omp for reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma omp parallel
+ {
+ #pragma omp for reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ sum += j;
+ }
+ }
+ }
+ if (sum != 450)
+ abort ();
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/pr49898-2.c b/libgomp/testsuite/libgomp.c/pr49898-2.c
new file mode 100644
index 00000000000..03ba0f8ffa0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr49898-2.c
@@ -0,0 +1,18 @@
+/* PR middle-end/49898 */
+/* { dg-do run } */
+
+extern void abort (void);
+
+int
+main ()
+{
+ int i, j, sum = 0;
+#pragma omp parallel for reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma omp parallel for reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ sum += j;
+ if (sum != 450)
+ abort ();
+ return 0;
+}