2016-08-08 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/72781
+ * omp-low.c (lower_lastprivate_clauses): Set TREE_NO_WARNING on the
+ private vars for lastprivate and for linear iterator.
+
PR middle-end/68762
* omp-simd-clone.c: Include varasm.h.
(simd_clone_create): Copy over DECL_COMDAT, DECL_WEAK, DECL_EXTERNAL,
new_var = lookup_decl (var, ctx->outer);
}
else
- new_var = lookup_decl (var, ctx);
+ {
+ new_var = lookup_decl (var, ctx);
+ /* Avoid uninitialized warnings for lastprivate and
+ for linear iterators. */
+ if (predicate
+ && (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
+ || OMP_CLAUSE_LINEAR_NO_COPYIN (c)))
+ TREE_NO_WARNING (new_var) = 1;
+ }
if (simduid && DECL_HAS_VALUE_EXPR_P (new_var))
{
2016-08-08 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/72781
+ * gcc.dg/gomp/pr72781.c: New test.
+
PR middle-end/68762
* g++.dg/vect/pr68762-1.cc: New test.
* g++.dg/vect/pr68762-2.cc: New test.
--- /dev/null
+/* PR middle-end/72781 */
+/* { dg-do compile } */
+/* { dg-additional-options "-O2 -Wuninitialized" } */
+
+int u;
+
+void
+foo (int *p)
+{
+ int i;
+ #pragma omp for simd lastprivate(u) schedule (static, 32) /* { dg-bogus "may be used uninitialized in this function" } */
+ for (i = 0; i < 1024; i++)
+ u = p[i];
+}
+
+void
+bar (int *p)
+{
+ int i;
+ #pragma omp taskloop simd lastprivate(u) /* { dg-bogus "may be used uninitialized in this function" } */
+ for (i = 0; i < 1024; i++)
+ u = p[i];
+}