+2019-01-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/89002
+ * gimplify.c (gimplify_omp_for): When adding OMP_CLAUSE_*_GIMPLE_SEQ
+ for lastprivate/linear IV, push gimplify context around gimplify_assign
+ and, if it needed any temporaries, pop it into a gimple bind around the
+ sequence.
+
2019-01-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
* common.opt (-Wattribute-alias): Remove "no-" from name.
seq = &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c);
else
seq = &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c);
+ push_gimplify_context ();
gimplify_assign (decl, t, seq);
- }
+ gimple *bind = NULL;
+ if (gimplify_ctxp->temps)
+ {
+ bind = gimple_build_bind (NULL_TREE, *seq, NULL_TREE);
+ *seq = NULL;
+ gimplify_seq_add_stmt (seq, bind);
+ }
+ pop_gimplify_context (bind);
+ }
}
}
+2019-01-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/89002
+ * testsuite/libgomp.c/pr89002.c: New test.
+
2019-01-28 Richard Biener <rguenther@suse.de>
PR testsuite/89064
--- /dev/null
+/* PR middle-end/89002 */
+
+extern void abort (void);
+
+int
+foo (int x)
+{
+ int a;
+ int *p = &a;
+
+#pragma omp taskloop lastprivate (a)
+ for (a = 0; a < x; ++a)
+ ;
+ return *p;
+}
+
+int
+bar (int x)
+{
+ int a;
+ int *p = &a;
+
+#pragma omp parallel
+#pragma omp single
+#pragma omp taskloop lastprivate (a)
+ for (a = 0; a < x; ++a)
+ ;
+ return *p;
+}
+
+int
+main ()
+{
+#pragma omp parallel
+#pragma omp single
+ {
+ if (foo (4) != 4)
+ abort ();
+ }
+ if (bar (6) != 6)
+ abort ();
+ return 0;
+}
+/* PR middle-end/89002 */
+
+extern void abort (void);
+
+int
+foo (int x)
+{
+ int a;
+ int *p = &a;
+
+#pragma omp taskloop lastprivate (a)
+ for (a = 0; a < x; ++a)
+ ;
+ return *p;
+}
+
+int
+bar (int x)
+{
+ int a;
+ int *p = &a;
+
+#pragma omp parallel
+#pragma omp single
+#pragma omp taskloop lastprivate (a)
+ for (a = 0; a < x; ++a)
+ ;
+ return *p;
+}
+
+int
+main ()
+{
+#pragma omp parallel
+#pragma omp single
+ {
+ if (foo (4) != 4)
+ abort ();
+ }
+ if (bar (6) != 6)
+ abort ();
+ return 0;
+}