Peter Klausler 0c0b2ea988
[flang] Check procedure pointer initializations; clean up ELEMENTAL
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
2023-08-29 15:08:23 -07:00

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