Peter Klausler 55ee00e15f
[flang][CUDA] Allow constant to match device actual in specific procedure (#178658)
When scanning the specific procedures of a generic interface for a match
for a set of actual arguments, accept a constant actual argument as a
match for a dummy argument with the DEVICE attribute.
2026-01-31 14:47:49 -08:00

27 lines
716 B
Plaintext

!RUN: %python %S/test_errors.py %s %flang_fc1 -x cuda
module m
interface randomNumber
module procedure rngScalar, rngArray
end interface
integer :: host_n = 3
contains
attributes(device) function rngScalar() result(res)
real :: res
res = 123.
end
attributes(device) function rngArray(n) result(res)
integer, intent(in) :: n
real :: res(n)
res = 123.
end
attributes(device) function randomPointInUnitSphere() result(res)
real :: res(3)
integer :: n
res = randomNumber(3) ! ok, constant
n = 3
res = randomNumber(n) ! ok, local
!ERROR: No specific function of generic 'randomnumber' matches the actual arguments
res = randomNumber(host_n)
end
end