[llvm] [flang][cuda] Fix unittest (PR #150136)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 23 01:52:58 PDT 2025
================
@@ -79,6 +79,6 @@ 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, kDeviceAllocatorPos, __FILE__, __LINE__);
----------------
Meinersbur wrote:
```suggestion
RTNAME(CUFSetAllocatorIndex)(a.get(), kDeviceAllocatorPos, __FILE__, __LINE__);
```
```
../../../../_src/flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp:82:3: error: no matching function for call to '_FortranACUFSetAllocatorIndex'
82 | RTNAME(CUFSetAllocatorIndex)(a, kDeviceAllocatorPos, __FILE__, __LINE__);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../_src/flang/include/flang/Runtime/entry-names.h:27:22: note: expanded from macro 'RTNAME'
27 | #define RTNAME(name) NAME_WITH_PREFIX_AND_REVISION(_Fortran, A, name)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../_src/flang/include/flang/Runtime/entry-names.h:26:3: note: expanded from macro 'NAME_WITH_PREFIX_AND_REVISION'
26 | prefix##revision##name
| ^~~~~~~~~~~~~~~~~~~~~~
<scratch space>:42:1: note: expanded from here
42 | _FortranACUFSetAllocatorIndex
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../_src/flang/include/flang/Runtime/CUDA/descriptor.h:45:6: note: candidate function not viable: no known conversion from 'OwningPtr<Descriptor>' to 'Descriptor *' for 1st argument
45 | void RTDECL(CUFSetAllocatorIndex)(Descriptor *, int index,
| ^ ~~~~~~~~~~~~
../../../../_src/flang/include/flang/Runtime/entry-names.h:31:35: note: expanded from macro 'RTDECL'
31 | #define RTDECL(name) RT_API_ATTRS RTNAME(name)
| ^
../../../../_src/flang/include/flang/Runtime/entry-names.h:27:22: note: expanded from macro 'RTNAME'
27 | #define RTNAME(name) NAME_WITH_PREFIX_AND_REVISION(_Fortran, A, name)
| ^
../../../../_src/flang/include/flang/Runtime/entry-names.h:26:3: note: expanded from macro 'NAME_WITH_PREFIX_AND_REVISION'
26 | prefix##revision##name
| ^
<scratch space>:16:1: note: expanded from here
16 | _FortranACUFSetAllocatorIndex
| ^
1 error generated.
```
My initial suggestion seems to have been wrong. `createAllocatable` returns an `OwningPtr<Descriptor>`, not a `Descriptor *`.
https://github.com/llvm/llvm-project/pull/150136
More information about the llvm-commits
mailing list