r314220 - [OPENMP] Fix handling of implicit mapping of array sections.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 26 09:19:04 PDT 2017


Author: abataev
Date: Tue Sep 26 09:19:04 2017
New Revision: 314220

URL: http://llvm.org/viewvc/llvm-project?rev=314220&view=rev
Log:
[OPENMP] Fix handling of implicit mapping of array sections.

Modified:
    cfe/trunk/lib/Sema/SemaOpenMP.cpp
    cfe/trunk/test/OpenMP/target_map_messages.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=314220&r1=314219&r2=314220&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Sep 26 09:19:04 2017
@@ -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;
               })) {

Modified: cfe/trunk/test/OpenMP/target_map_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_map_messages.cpp?rev=314220&r1=314219&r2=314220&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_map_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/target_map_messages.cpp Tue Sep 26 09:19:04 2017
@@ -592,6 +592,8 @@ int main(int argc, char **argv) {
 #pragma omp target map(s.p->p->p->a)
 // expected-error at +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}}
 }




More information about the cfe-commits mailing list