diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-08-08 21:46:36 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-08-08 21:46:36 +0200 |
commit | 2187f2a2613385f22499ea19f0122b73513ac193 (patch) | |
tree | 6020346fe555f3544d9d56f623f61d7531414c06 | |
parent | ad20058031e8610712a70728a39b6a85edf785df (diff) | |
download | gcc-2187f2a2613385f22499ea19f0122b73513ac193.zip gcc-2187f2a2613385f22499ea19f0122b73513ac193.tar.gz gcc-2187f2a2613385f22499ea19f0122b73513ac193.tar.bz2 |
re PR middle-end/72781 (-Wuninitialized false positives in OpenMP code)
PR middle-end/72781
* omp-low.c (lower_lastprivate_clauses): Set TREE_NO_WARNING on the
private vars for lastprivate and for linear iterator.
* gcc.dg/gomp/pr72781.c: New test.
From-SVN: r239249
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/omp-low.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/pr72781.c | 23 |
4 files changed, 39 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e6f0761..3cf7074 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 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, diff --git a/gcc/omp-low.c b/gcc/omp-low.c index c75452c..678c36e 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -5455,7 +5455,15 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list, 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)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0822a8a..ddc0980 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 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. diff --git a/gcc/testsuite/gcc.dg/gomp/pr72781.c b/gcc/testsuite/gcc.dg/gomp/pr72781.c new file mode 100644 index 0000000..377fdde --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr72781.c @@ -0,0 +1,23 @@ +/* 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]; +} |