[Openmp-commits] [openmp] ee9c53d - [libomptarget] Initialize reference parameter IsNew within Device::getOrAllocTgtPtr

Ron Lieberman via Openmp-commits openmp-commits at lists.llvm.org
Fri Apr 24 13:36:17 PDT 2020


Author: Ron Lieberman
Date: 2020-04-24T15:33:37-05:00
New Revision: ee9c53d27106689daf9f9f26354bead6ccad4ef1

URL: https://github.com/llvm/llvm-project/commit/ee9c53d27106689daf9f9f26354bead6ccad4ef1
DIFF: https://github.com/llvm/llvm-project/commit/ee9c53d27106689daf9f9f26354bead6ccad4ef1.diff

LOG: [libomptarget] Initialize reference parameter IsNew within Device::getOrAllocTgtPtr

The two locals IsNew and Pointer_IsNew were uninitialized at declaration, and then passed by
reference to Device.getOrAllocTgtPtr which in turn did not assign on all
paths within the function. This resulted in occasional runtime failures in one application.
Device::getOrAllocTgtPtr will now initialize IsNew to false on entry to function.

Differential Revision: https://reviews.llvm.org/D78744

Added: 
    

Modified: 
    openmp/libomptarget/src/device.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/src/device.cpp b/openmp/libomptarget/src/device.cpp
index 765dd54fe5ca..b613cd2eccb9 100644
--- a/openmp/libomptarget/src/device.cpp
+++ b/openmp/libomptarget/src/device.cpp
@@ -157,6 +157,7 @@ void *DeviceTy::getOrAllocTgtPtr(void *HstPtrBegin, void *HstPtrBase,
     bool UpdateRefCount, bool HasCloseModifier) {
   void *rc = NULL;
   IsHostPtr = false;
+  IsNew = false;
   DataMapMtx.lock();
   LookupResult lr = lookupMapping(HstPtrBegin, Size);
 


        


More information about the Openmp-commits mailing list