[PATCH] D11619: [OPENMP] allow static local variable on data-sharing attribute clause

Kelvin Li kkwli0 at gmail.com
Wed Jul 29 18:23:23 PDT 2015

kkwli0 created this revision.
kkwli0 added reviewers: rsmith, hfinkel, fraggamuffin, sfantao, ABataev.
kkwli0 added a subscriber: cfe-commits.

This patch is to fix the problem of specifying static local variables on the data-sharing attribute clause.  Currently, clang flags it as errors.

int main() {
 static int x; 
  int i; 
#pragma omp parallel for reduction(+:x) 
  for (i=0; i<10; i++) { 
    x = 1; 



Index: lib/Sema/SemaOpenMP.cpp
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -521,7 +521,7 @@
     // in a Construct, C/C++, predetermined, p.7]
     //  Variables with static storage duration that are declared in a scope
     //  inside the construct are shared.
-    if (D->isStaticDataMember() || D->isStaticLocal()) {
+    if (D->isStaticDataMember()) {
       DSAVarData DVarTemp =
           hasDSA(D, isOpenMPPrivate, MatchesAlways(), FromParent);
       if (DVarTemp.CKind != OMPC_unknown && DVarTemp.RefExpr)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11619.30977.patch
Type: text/x-patch
Size: 599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150730/6556848f/attachment.bin>

More information about the cfe-commits mailing list