mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 03:56:42 +00:00

Implements compatibility checking for initializers in procedure pointer declarations. This work exposed some inconsistency in how ELEMENTAL interfaces were handled and checked, from both unrestricted intrinsic functions and others, and some refinements needed for function result compatbility checking; these have also been ironed out. Some new warnings are now emitted, and this affected a dozen or so tests. Differential Revision: https://reviews.llvm.org/D159026
49 lines
940 B
Fortran
49 lines
940 B
Fortran
! RUN: %python %S/test_modfile.py %s %flang_fc1
|
|
! Ensure that symbols and types needed to declare procedures and procedure pointers
|
|
! are properly imported into interfaces.
|
|
module m
|
|
type :: t
|
|
end type
|
|
abstract interface
|
|
subroutine iface
|
|
end
|
|
end interface
|
|
procedure(iface) :: ext
|
|
interface
|
|
subroutine subr(p1,p2)
|
|
import ext, t
|
|
procedure(ext) :: p1
|
|
procedure(type(t)), pointer :: p2
|
|
end subroutine
|
|
function fun() result(res)
|
|
import subr
|
|
procedure(subr), pointer :: res
|
|
end function
|
|
end interface
|
|
end module
|
|
|
|
!Expect: m.mod
|
|
!module m
|
|
!type::t
|
|
!end type
|
|
!abstract interface
|
|
!subroutine iface()
|
|
!end
|
|
!end interface
|
|
!procedure(iface)::ext
|
|
!interface
|
|
!subroutine subr(p1,p2)
|
|
!import::ext
|
|
!import::t
|
|
!procedure(ext)::p1
|
|
!procedure(type(t)),pointer::p2
|
|
!end
|
|
!end interface
|
|
!interface
|
|
!function fun() result(res)
|
|
!import::subr
|
|
!procedure(subr),pointer::res
|
|
!end
|
|
!end interface
|
|
!end
|