diff options
author | Joel E. Denny <jdenny.ornl@gmail.com> | 2018-06-28 19:46:10 +0000 |
---|---|---|
committer | Joel E. Denny <jdenny.ornl@gmail.com> | 2018-06-28 19:46:10 +0000 |
commit | 82e9ea5b49bd65ee31b557a72617567a3cb1602c (patch) | |
tree | 9d2a843ecf659280d78ca4c379dd726afac3df62 | |
parent | aa6c3f50e39546401e723f513bb78df783d9edab (diff) | |
download | bcm5719-llvm-82e9ea5b49bd65ee31b557a72617567a3cb1602c.tar.gz bcm5719-llvm-82e9ea5b49bd65ee31b557a72617567a3cb1602c.zip |
[OPENMP] Fix incomplete type check for array reductions
A reduction for an incomplete array type used to produce an assert
fail during codegen. Now it produces a diagnostic.
llvm-svn: 335907
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 2 | ||||
-rw-r--r-- | clang/test/OpenMP/parallel_reduction_messages.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 7da9df90acb..6fb0125e6eb 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -10335,7 +10335,7 @@ static bool actOnOMPReductionKindClause( // OpenMP [2.9.3.3, Restrictions, C/C++, p.3] // A variable that appears in a private clause must not have an incomplete // type or a reference type. - if (S.RequireCompleteType(ELoc, Type, + if (S.RequireCompleteType(ELoc, D->getType(), diag::err_omp_reduction_incomplete_type)) continue; // OpenMP [2.14.3.6, reduction clause, Restrictions] diff --git a/clang/test/OpenMP/parallel_reduction_messages.c b/clang/test/OpenMP/parallel_reduction_messages.c new file mode 100644 index 00000000000..f88f8e05649 --- /dev/null +++ b/clang/test/OpenMP/parallel_reduction_messages.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 150 -o - %s + +int incomplete[]; + +void test() { +#pragma omp parallel reduction(+ : incomplete) // expected-error {{a reduction list item with incomplete type 'int []'}} + ; +} + +// complete to suppress an additional warning, but it's too late for pragmas +int incomplete[3]; |