Hi!

The .count.NN vars have TREE_NO_WARNING set on them, because
they may be uninitialized if the loop body isn't executed at all
(zero trip count), but copy_var_decl wasn't propagating the flag over to
the parallel body ompfn function vars.

Fixed thusly, tested on x86_64-linux, committed to trunk/4.8.

2013-08-28  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/58257
        * omp-low.c (copy_var_decl): Copy over TREE_NO_WARNING flag.

        * c-c++-common/gomp/pr58257.c: New test.

--- gcc/omp-low.c.jj    2013-08-28 11:27:54.000000000 +0200
+++ gcc/omp-low.c       2013-08-28 11:39:07.578948737 +0200
@@ -850,6 +850,7 @@ copy_var_decl (tree var, tree name, tree
   DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (var);
   DECL_IGNORED_P (copy) = DECL_IGNORED_P (var);
   DECL_CONTEXT (copy) = DECL_CONTEXT (var);
+  TREE_NO_WARNING (copy) = TREE_NO_WARNING (var);
   TREE_USED (copy) = 1;
   DECL_SEEN_IN_BIND_EXPR_P (copy) = 1;
 
--- gcc/testsuite/c-c++-common/gomp/pr58257.c.jj        2013-08-28 
11:56:17.991343584 +0200
+++ gcc/testsuite/c-c++-common/gomp/pr58257.c   2013-08-28 11:58:24.616648066 
+0200
@@ -0,0 +1,15 @@
+/* PR middle-end/58257 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -Wall" } */
+
+int
+foo (int n)
+{
+  int a[10][10];
+  int x, y;
+#pragma omp parallel for collapse(2)   /* { dg-bogus "may be used 
uninitialized in this function" } */
+  for (x = 0; x < n; x++)              /* { dg-bogus "may be used 
uninitialized in this function" } */
+    for (y = 0; y < n; y++)
+      a[x][y] = x + y * y;
+  return a[0][0];
+}

        Jakub

Reply via email to