]> granicus.if.org Git - clang/commitdiff
[OPENMP] Fix handling of implicit mapping of array sections.
authorAlexey Bataev <a.bataev@hotmail.com>
Tue, 26 Sep 2017 16:19:04 +0000 (16:19 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Tue, 26 Sep 2017 16:19:04 +0000 (16:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314220 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOpenMP.cpp
test/OpenMP/target_map_messages.cpp

index 735e827eeae7a68e604036f66083fa40fb9b201d..4d04f5a8372733771a9263d42c9d83cdcf43e7c9 100644 (file)
@@ -1972,9 +1972,8 @@ public:
                   OMPClauseMappableExprCommon::MappableExprComponentListRef
                       StackComponents,
                   OpenMPClauseKind) {
-                if (CurComponents.size() < StackComponents.size())
-                  return false;
                 auto CCI = CurComponents.rbegin();
+                auto CCE = CurComponents.rend();
                 for (const auto &SC : llvm::reverse(StackComponents)) {
                   // Do both expressions have the same kind?
                   if (CCI->getAssociatedExpression()->getStmtClass() !=
@@ -1992,6 +1991,8 @@ public:
                   if (SCD != CCD)
                     return false;
                   std::advance(CCI, 1);
+                  if (CCI == CCE)
+                    break;
                 }
                 return true;
               })) {
index b7c1b074bc35b178da8646e4f5c3c62f4026ddf1..f607dcf369845ef5ef6dba8cf929c78baa94a857 100644 (file)
@@ -592,6 +592,8 @@ int main(int argc, char **argv) {
 #pragma omp target map(s.p->p->p->a)
 // expected-error@+1 {{variable already marked as mapped in current construct}}
   { s.a++; }
+#pragma omp target map(s.s.s.b[:2])
+  { s.s.s.b[0]++; }
 
   return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}}
 }