diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -9664,11 +9664,10 @@ TargetDataInfo Info; // Fill up the arrays and create the arguments. emitOffloadingArrays(CGF, CombinedInfo, Info); - bool HasDependClauses = D.hasClausesOfKind(); emitOffloadingArraysArgument(CGF, Info.BasePointersArray, Info.PointersArray, Info.SizesArray, Info.MapTypesArray, Info.MappersArray, Info, - {/*ForEndTask=*/false, HasDependClauses}); + {/*ForEndTask=*/false, RequiresOuterTask}); InputInfo.NumberOfTargetItems = Info.NumberOfPtrs; InputInfo.BasePointersArray = Address(Info.BasePointersArray, CGM.getPointerAlign()); diff --git a/openmp/libomptarget/test/offloading/bug47654.cpp b/openmp/libomptarget/test/offloading/bug47654.cpp new file mode 100644 --- /dev/null +++ b/openmp/libomptarget/test/offloading/bug47654.cpp @@ -0,0 +1,29 @@ +// RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu +// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu +// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu +// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu +// RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda + +#include +#include + +int main(int argc, char *argv[]) { + int i = 0, j = 0; + +#pragma omp target map(tofrom : i, j) nowait + { + i = 1; + j = 2; + } + +#pragma omp taskwait + + assert(i == 1); + assert(j == 2); + + std::cout << "PASS\n"; + + return 0; +} + +// CHECK: PASS