From: Alexey Bataev Date: Tue, 26 Sep 2017 16:19:04 +0000 (+0000) Subject: [OPENMP] Fix handling of implicit mapping of array sections. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1cb203aa36434d9ce8a303c92785ac11a1217053;p=clang [OPENMP] Fix handling of implicit mapping of array sections. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314220 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 735e827eea..4d04f5a837 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -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; })) { diff --git a/test/OpenMP/target_map_messages.cpp b/test/OpenMP/target_map_messages.cpp index b7c1b074bc..f607dcf369 100644 --- a/test/OpenMP/target_map_messages.cpp +++ b/test/OpenMP/target_map_messages.cpp @@ -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(argc)+tmain(argc); // expected-note {{in instantiation of function template specialization 'tmain' requested here}} expected-note {{in instantiation of function template specialization 'tmain' requested here}} }