[llvm] [flang][cuda] Use get() to get raw pointer (PR #150205)

Valentin Clement バレンタイン クレメン via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 03:48:53 PDT 2025


https://github.com/clementval created https://github.com/llvm/llvm-project/pull/150205

Fix issue reported in #150136. `createAllocatable` returns an OwingPtr. Use `get()` to get the raw pointer has it is done in the `flang-rt/unittests/Runtime/CUDA/Memory.cpp` tests. 

>From 79a889036f19c4341ece450b5a6bce8e2ca3cf1c Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Wed, 23 Jul 2025 03:46:00 -0700
Subject: [PATCH] [flang][cuda] Use get() to get raw pointer

---
 flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp b/flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp
index d76fca2c4250e..4b22e29cc8172 100644
--- a/flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp
+++ b/flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp
@@ -79,6 +79,7 @@ TEST(AllocatableCUFTest, CUFSetAllocatorIndex) {
   // REAL(4), DEVICE, ALLOCATABLE :: a(:)
   auto a{createAllocatable(TypeCategory::Real, 4)};
   EXPECT_EQ((int)kDefaultAllocator, a->GetAllocIdx());
-  RTNAME(CUFSetAllocatorIndex)(a, kDeviceAllocatorPos, __FILE__, __LINE__);
+  RTNAME(CUFSetAllocatorIndex)(
+      a.get(), kDeviceAllocatorPos, __FILE__, __LINE__);
   EXPECT_EQ((int)kDeviceAllocatorPos, a->GetAllocIdx());
 }



More information about the llvm-commits mailing list