2 ! This tests the fix for PR16940, module interfaces to
3 ! contained functions caused ICEs.
4 ! This is a simplified version of the example in the PR
5 ! discussion, which was due to L.Meissner.
7 ! Submitted by Paul Thomas pault@gcc.gnu.org
11 interface Max_Location
12 module procedure I_Max_Loc
15 function I_Max_Loc (Vector) result(Ans)
16 integer, intent (in), dimension(:) :: Vector
17 integer, dimension(1) :: Ans
20 end function I_Max_Loc
21 end module Max_Loc_Mod
22 program module_interface
26 Vector = (/1,6,3,5,19,1,2/)
27 call Selection_Sort (Vector)
29 subroutine Selection_Sort (Unsorted)
30 integer, intent (in), dimension(:) :: Unsorted
31 integer, dimension (1) :: N
32 N = Max_Location (Unsorted)
33 if (N(1).ne.5) call abort ()
35 end subroutine Selection_Sort
36 end program module_interface
38 ! { dg-final { cleanup-modules "Max_Loc_mod" } }