@@ -399,8 +399,10 @@ static int performPointerAttachment(DeviceTy &Device, AsyncInfoTy &AsyncInfo,
399399 int64_t VoidPtrSize = sizeof (void *);
400400 assert (HstPtrSize >= VoidPtrSize && " PointerSize is too small" );
401401
402- uint64_t Delta = (uint64_t )HstPteeBegin - (uint64_t )HstPteeBase;
403- void *TgtPteeBase = (void *)((uint64_t )TgtPteeBegin - Delta);
402+ uint64_t Delta = reinterpret_cast <uint64_t >(HstPteeBegin) -
403+ reinterpret_cast <uint64_t >(HstPteeBase);
404+ void *TgtPteeBase = reinterpret_cast <void *>(
405+ reinterpret_cast <uint64_t >(TgtPteeBegin) - Delta);
404406
405407 // Add shadow pointer tracking
406408 // TODO: Support shadow-tracking of larger than VoidPtrSize pointers,
@@ -463,7 +465,8 @@ static int performPointerAttachment(DeviceTy &Device, AsyncInfoTy &AsyncInfo,
463465 // And to the remaining bytes, we copy the remaining contents of the host
464466 // descriptor after the initial VoidPtrSize bytes.
465467 uint64_t HstDescriptorFieldsSize = HstPtrSize - VoidPtrSize;
466- void *HstDescriptorFieldsAddr = (char *)HstPtrAddr + VoidPtrSize;
468+ void *HstDescriptorFieldsAddr =
469+ reinterpret_cast <char *>(HstPtrAddr) + VoidPtrSize;
467470 std::memcpy (DataBuffer + VoidPtrSize, HstDescriptorFieldsAddr,
468471 HstDescriptorFieldsSize);
469472
@@ -613,7 +616,7 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
613616 (PointerTpr.Flags .IsNewEntry ? " " : " not" ));
614617 PointerHstPtrBegin = HstPtrBase;
615618 // modify current entry.
616- HstPtrBase = *( void **) HstPtrBase;
619+ HstPtrBase = *reinterpret_cast < void **>( HstPtrBase) ;
617620 // No need to update pointee ref count for the first element of the
618621 // subelement that comes from mapper.
619622 UpdateRef =
@@ -655,9 +658,10 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
655658
656659 if (ArgTypes[I] & OMP_TGT_MAPTYPE_PTR_AND_OBJ && !IsHostPtr) {
657660 int Ret = performPointerAttachment (
658- Device, AsyncInfo, (void **)PointerHstPtrBegin, HstPtrBase,
659- HstPtrBegin, (void **)PointerTgtPtrBegin, TgtPtrBegin, sizeof (void *),
660- PointerTpr);
661+ Device, AsyncInfo, reinterpret_cast <void **>(PointerHstPtrBegin),
662+ HstPtrBase, HstPtrBegin,
663+ reinterpret_cast <void **>(PointerTgtPtrBegin), TgtPtrBegin,
664+ sizeof (void *), PointerTpr);
661665 if (Ret != OFFLOAD_SUCCESS)
662666 return OFFLOAD_FAIL;
663667 }
@@ -746,7 +750,7 @@ int processAttachEntries(DeviceTy &Device, AttachInfoTy &AttachInfo,
746750 ++EntryIdx) {
747751 const auto &AttachEntry = AttachInfo.AttachEntries [EntryIdx];
748752
749- void **HstPtr = ( void **) AttachEntry.PointerBase ;
753+ void **HstPtr = reinterpret_cast < void **>( AttachEntry.PointerBase ) ;
750754
751755 void *HstPteeBase = *HstPtr;
752756 void *HstPteeBegin = AttachEntry.PointeeBegin ;
@@ -767,7 +771,8 @@ int processAttachEntries(DeviceTy &Device, AttachInfoTy &AttachInfo,
767771 void *AllocPtr = Alloc.first ;
768772 int64_t AllocSize = Alloc.second ;
769773 return Ptr >= AllocPtr &&
770- Ptr < (void *)((char *)AllocPtr + AllocSize);
774+ Ptr < reinterpret_cast <void *>(
775+ reinterpret_cast <char *>(AllocPtr) + AllocSize);
771776 });
772777 DP (" ATTACH entry %zu: %s pointer " DPxMOD " was newly allocated: %s\n " ,
773778 EntryIdx, PtrName, DPxPTR (Ptr), IsNewlyAllocated ? " yes" : " no" );
@@ -823,7 +828,7 @@ int processAttachEntries(DeviceTy &Device, AttachInfoTy &AttachInfo,
823828 if (!PtrTPROpt)
824829 continue ;
825830 TargetPointerResultTy &PtrTPR = *PtrTPROpt;
826- void **TgtPtrBase = ( void **) PtrTPR.TargetPointer ;
831+ void **TgtPtrBase = reinterpret_cast < void **>( PtrTPR.TargetPointer ) ;
827832
828833 // Get device version of the pointee (e.g., &p[10])
829834 auto PteeTPROpt = LookupTargetPointer (HstPteeBegin, 0 , " pointee" );
0 commit comments