[flang][cuda] Allow POINTER component to have device attribute (#126116)

This commit is contained in:
Valentin Clement (バレンタイン クレメン) 2025-02-06 19:43:04 -08:00 committed by GitHub
parent d9500f5032
commit b00b193728
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -989,9 +989,9 @@ void CheckHelper::CheckObjectEntity(
}
break;
case common::CUDADataAttr::Device:
if (isComponent && !IsAllocatable(symbol)) {
if (isComponent && !IsAllocatable(symbol) && !IsPointer(symbol)) {
messages_.Say(
"Component '%s' with ATTRIBUTES(DEVICE) must also be allocatable"_err_en_US,
"Component '%s' with ATTRIBUTES(DEVICE) must also be allocatable or pointer"_err_en_US,
symbol.name());
}
break;

View File

@ -54,6 +54,14 @@ module m
!ERROR: Object 'um' with ATTRIBUTES(UNIFIED) must be declared in a host subprogram
real, unified :: um
type :: t3
!ERROR: Component 'r' with ATTRIBUTES(DEVICE) must also be allocatable or pointer
real, device :: r
real, device, pointer :: rp ! ok
real, device, allocatable :: ra ! ok
real, device, pointer, contiguous :: rpc ! ok
end type
contains
attributes(device) subroutine devsubr(n,da,rs)
integer, intent(in) :: n