[flang][cuda] Do not consider kernel result as host variable (#190626)

This commit is contained in:
Valentin Clement (バレンタイン クレメン) 2026-04-06 09:39:38 -07:00 committed by GitHub
parent 9265f9284c
commit baa1e5008b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -138,13 +138,13 @@ struct FindHostArray
using Base::operator();
Result operator()(const evaluate::Component &x) const {
const Symbol &symbol{x.GetLastSymbol()};
if (symbol.IsFuncResult()) {
const Symbol &baseSymbol{x.base().GetFirstSymbol()};
if (symbol.IsFuncResult() || baseSymbol.IsFuncResult()) {
return nullptr;
}
if (!IsHostArray(symbol)) {
return nullptr;
}
const Symbol &baseSymbol{x.base().GetFirstSymbol()};
if (IsDummy(baseSymbol) && IsCUDADeviceContext(&baseSymbol.owner())) {
return nullptr;
}

View File

@ -4,6 +4,9 @@ module m
type bar
integer, allocatable :: m(:)
end type
type r1
real :: origin(3)
end type r1
contains
attributes(global) subroutine g1( a )
type(bar) :: a
@ -11,4 +14,9 @@ contains
a%m(i) = i
return
end subroutine
attributes(device) function rayConstructor(origin, dir) result(r)
real :: origin(3), dir(3)
type(r1) :: r
r%origin = origin
end function
end module m