+2019-03-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/89651
+ * trans-openmp.c (gfc_omp_clause_default_ctor): Set TREE_NO_WARNING
+ on decl if adding COND_EXPR for allocatable.
+ (gfc_omp_clause_copy_ctor): Set TREE_NO_WARNING on dest.
+
2019-03-11 Martin Liska <mliska@suse.cz>
* decl.c (match_record_decl): Wrap an option name
build3_loc (input_location, COND_EXPR,
void_type_node, cond, then_b,
else_b));
+ /* Avoid -W*uninitialized warnings. */
+ if (DECL_P (decl))
+ TREE_NO_WARNING (decl) = 1;
}
else
gfc_add_expr_to_block (&block, then_b);
gfc_add_expr_to_block (&block,
build3_loc (input_location, COND_EXPR,
void_type_node, cond, then_b, else_b));
+ /* Avoid -W*uninitialized warnings. */
+ if (DECL_P (dest))
+ TREE_NO_WARNING (dest) = 1;
return gfc_finish_block (&block);
}
2019-03-11 Jakub Jelinek <jakub@redhat.com>
+ PR fortran/89651
+ * gfortran.dg/gomp/pr89651.f90: New test.
+
PR middle-end/89655
PR bootstrap/89656
* gcc.c-torture/compile/pr89655.c: New test.
--- /dev/null
+! PR fortran/89651
+! { dg-do compile }
+! { dg-additional-options "-Wuninitialized" }
+
+program pr89651
+ integer :: n
+ real, allocatable :: t(:)
+ n = 10
+ allocate (t(n), source = 0.0)
+!$omp parallel firstprivate(t)
+ print *, sum (t) ! { dg-bogus "lbound' may be used uninitialized in this function" }
+ ! { dg-bogus "ubound' may be used uninitialized in this function" "" { target *-*-* } .-1 }
+ ! { dg-bogus "offset' may be used uninitialized in this function" "" { target *-*-* } .-2 }
+!$omp end parallel
+!$omp parallel private(t)
+ t = 0.0
+ print *, sum (t) ! { dg-bogus "lbound' may be used uninitialized in this function" }
+ ! { dg-bogus "ubound' may be used uninitialized in this function" "" { target *-*-* } .-1 }
+ ! { dg-bogus "offset' may be used uninitialized in this function" "" { target *-*-* } .-2 }
+!$omp end parallel
+end program pr89651