[Openmp-commits] [PATCH] D119471: [OpenMP][Offloading] Fix infinite loop in applyToShadowMapEntries

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 10 12:33:13 PST 2022


tianshilei1992 created this revision.
tianshilei1992 added a reviewer: jdoerfert.
Herald added subscribers: guansong, yaxunl.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

This patch fixes the issue that the for loop in `applyToShadowMapEntries`
is infinite because `Itr` is not incremented in `CB`. Fixes #53727.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119471

Files:
  openmp/libomptarget/src/omptarget.cpp


Index: openmp/libomptarget/src/omptarget.cpp
===================================================================
--- openmp/libomptarget/src/omptarget.cpp
+++ openmp/libomptarget/src/omptarget.cpp
@@ -889,6 +889,7 @@
       DP("Restoring original host pointer value " DPxMOD
          " for host pointer " DPxMOD "\n",
          DPxPTR(Itr->second.HstPtrVal), DPxPTR(ShadowHstPtrAddr));
+      ++Itr;
       return OFFLOAD_SUCCESS;
     };
     applyToShadowMapEntries(Device, CB, HstPtrBegin, ArgSize, TPR);
@@ -911,6 +912,7 @@
                               sizeof(void *), AsyncInfo);
       if (Ret != OFFLOAD_SUCCESS)
         REPORT("Copying data to device failed.\n");
+      ++Itr;
       return Ret;
     };
     applyToShadowMapEntries(Device, CB, HstPtrBegin, ArgSize, TPR);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119471.407642.patch
Type: text/x-patch
Size: 786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220210/df22332d/attachment.bin>


More information about the Openmp-commits mailing list