[Openmp-commits] [PATCH] D78744: [libomptarget] Initialize IsNew and Pointer_IsNew in target_data_begin

Ron Lieberman via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Apr 23 12:28:30 PDT 2020


ronlieb created this revision.
ronlieb added reviewers: grokos, ABataev, JonChesterfield, jdoerfert, openmp-commits.
Herald added a project: OpenMP.

  These two locals 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78744

Files:
  openmp/libomptarget/src/omptarget.cpp


Index: openmp/libomptarget/src/omptarget.cpp
===================================================================
--- openmp/libomptarget/src/omptarget.cpp
+++ openmp/libomptarget/src/omptarget.cpp
@@ -247,7 +247,7 @@
 
     // Address of pointer on the host and device, respectively.
     void *Pointer_HstPtrBegin, *Pointer_TgtPtrBegin;
-    bool IsNew, Pointer_IsNew;
+    bool IsNew = false, Pointer_IsNew = false;
     bool IsHostPtr = false;
     bool IsImplicit = arg_types[i] & OMP_TGT_MAPTYPE_IMPLICIT;
     // Force the creation of a device side copy of the data when:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78744.259665.patch
Type: text/x-patch
Size: 578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200423/5d1d43e5/attachment.bin>


More information about the Openmp-commits mailing list