Files
Peter Klausler cbe3b72c4c [flang][CUDA] Downgrade error to warning (#161570)
The compiler currently emit an error about the lack of an explicit
procedure interface when an external procedure that is called via an
implicit interface is known to have an dummy argument with a CUDA data
attribute, even when the corresponding actual argument does have a CUDA
data attribute. This behavior is inconsistent with what happens when
such a call is to an external in another source file and its definition
is not visible -- the compiler silently accepts an actual argument with
a CUDA data attribute across the implicit interface.

Harmonize this situation so that an actual argument with a CUDA data
attribute in a reference to a procedure with an implicit interface
elicits a usage warning encouraging the use of explicit interfaces. Only
when the procedure's definition is visible, and incompatible, will an
error message appear.
2025-10-03 10:48:13 -07:00

43 lines
1.6 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Test 15.4.2.2 constraints and restrictions for calls to implicit
! interfaces
subroutine s(assumedRank, coarray, class, classStar, typeStar)
type :: t
end type
real :: assumedRank(..), coarray[*]
class(t) :: class
class(*) :: classStar
type(*) :: typeStar
type :: pdt(len)
integer, len :: len
end type
type(pdt(1)) :: pdtx
!ERROR: Invalid specification expression: reference to impure function 'implicit01'
real :: array(implicit01()) ! 15.4.2.2(2)
!ERROR: Keyword 'keyword=' may not appear in a reference to a procedure with an implicit interface
call implicit10(1, 2, keyword=3) ! 15.4.2.2(1)
!ERROR: Assumed rank argument 'assumedrank' requires an explicit interface
call implicit11(assumedRank) ! 15.4.2.2(3)(c)
call implicit12(coarray) ! ok
call implicit12a(coarray[1]) ! ok
!ERROR: Parameterized derived type actual argument requires an explicit interface
call implicit13(pdtx) ! 15.4.2.2(3)(e)
call implicit14(class) ! ok
!ERROR: Unlimited polymorphic actual argument requires an explicit interface
call implicit15(classStar) ! 15.4.2.2(3)(f)
!ERROR: Assumed type actual argument requires an explicit interface
call implicit16(typeStar) ! 15.4.2.2(3)(f)
!ERROR: TYPE(*) dummy argument may only be used as an actual argument
if (typeStar) then
endif
!ERROR: TYPE(*) dummy argument may only be used as an actual argument
classStar = typeStar ! C710
!ERROR: TYPE(*) dummy argument may only be used as an actual argument
typeStar = classStar ! C710
end subroutine