r237672 - [OPENMP] Prohibit variably modified types in 'copyprivate' clause.
Alexey Bataev
a.bataev at hotmail.com
Tue May 19 01:19:24 PDT 2015
Author: abataev
Date: Tue May 19 03:19:24 2015
New Revision: 237672
URL: http://llvm.org/viewvc/llvm-project?rev=237672&view=rev
Log:
[OPENMP] Prohibit variably modified types in 'copyprivate' clause.
Runtime does not allow to work with VLAs in copyprivate clause.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=237672&r1=237671&r2=237672&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue May 19 03:19:24 2015
@@ -7418,6 +7418,8 @@ def err_omp_no_dsa_for_variable : Error<
"variable %0 must have explicitly specified data sharing attributes">;
def err_omp_wrong_dsa : Error<
"%0 variable cannot be %1">;
+def err_omp_variably_modified_type_not_supported : Error<
+ "arguments of OpenMP clause '%0' cannot be of variably-modified type %1">;
def note_omp_explicit_dsa : Note<
"defined as %0">;
def note_omp_predetermined_dsa : Note<
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=237672&r1=237671&r2=237672&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue May 19 03:19:24 2015
@@ -6195,6 +6195,17 @@ OMPClause *Sema::ActOnOpenMPCopyprivateC
}
}
+ // Variably modified types are not supported.
+ if (Type->isVariablyModifiedType()) {
+ Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
+ << getOpenMPClauseName(OMPC_copyprivate) << Type;
+ bool IsDecl =
+ VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly;
+ Diag(VD->getLocation(),
+ IsDecl ? diag::note_previous_decl : diag::note_defined_here)
+ << VD;
+ continue;
+ }
// OpenMP [2.14.4.1, Restrictions, C/C++, p.2]
// A variable of class type (or array thereof) that appears in a
// copyin clause requires an accessible, unambiguous copy assignment
Modified: cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp?rev=237672&r1=237671&r2=237672&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp Tue May 19 03:19:24 2015
@@ -105,8 +105,8 @@ T tmain(T argc, C **argv) {
return T();
}
-void bar(S4 a[2]) {
-#pragma omp single copyprivate(a) // expected-error {{'operator=' is a private member of 'S4'}}
+void bar(S4 a[2], int n, int b[n]) { // expected-note {{'b' defined here}}
+#pragma omp single copyprivate(a, b) // expected-error {{'operator=' is a private member of 'S4'}} expected-error {{arguments of OpenMP clause 'copyprivate' cannot be of variably-modified type 'int [n]'}}
foo();
}
More information about the cfe-commits
mailing list