diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-07-11 14:54:17 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-07-11 14:54:17 +0000 |
| commit | c2c21ef9d2b37da6a8cc6322e4cd13fff3fe10b3 (patch) | |
| tree | 1a076924f9da09097dad43e9caa807bc8250b594 /clang/test/OpenMP/ordered_messages.cpp | |
| parent | d0307f93a7658e6d0eef1ffd0b0ed4f1506bfc13 (diff) | |
| download | bcm5719-llvm-c2c21ef9d2b37da6a8cc6322e4cd13fff3fe10b3.tar.gz bcm5719-llvm-c2c21ef9d2b37da6a8cc6322e4cd13fff3fe10b3.zip | |
[OPENMP]Initial fix PR42392: Improve -Wuninitialized warnings for OpenMP programs.
Summary:
Some OpenMP clauses rely on the values of the variables. If the variable
is not initialized and used in OpenMP clauses that depend on the
variables values, it should be reported that the uninitialized variable
is used in the OpenMP clause expression.
This patch adds initial processing for uninitialized variables in OpenMP
constructs. Currently, it checks for use of the uninitialized variables
in the structured blocks.
Reviewers: NoQ, Szelethus, dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet
Subscribers: rnkovacs, guansong, jfb, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64356
llvm-svn: 365786
Diffstat (limited to 'clang/test/OpenMP/ordered_messages.cpp')
| -rw-r--r-- | clang/test/OpenMP/ordered_messages.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/OpenMP/ordered_messages.cpp b/clang/test/OpenMP/ordered_messages.cpp index 6404ec8bf91..3fb69dbb60a 100644 --- a/clang/test/OpenMP/ordered_messages.cpp +++ b/clang/test/OpenMP/ordered_messages.cpp @@ -6,6 +6,15 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++98 -o - %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized +void xxx(int argc) { + int x; // expected-note {{initialize the variable 'x' to silence this warning}} +#pragma omp for ordered + for (int i = 0; i < 10; ++i) { +#pragma omp ordered + argc = x; // expected-warning {{variable 'x' is uninitialized when used here}} + } +} + int foo(); template <class T> |

