fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_comp_16.f90
blobe6b77a22f02350c26b5572e7df8d30f821fc4c29
1 ! { dg-do run }
3 ! PR 41106: [F03] Procedure Pointers with CHARACTER results
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7 module m
8 type :: t
9 procedure(abc), pointer, nopass :: ptr
10 end type
11 contains
12 function abc(i)
13 integer :: i
14 character(len=i) :: abc
15 abc = 'abcde'
16 end function abc
17 end module m
19 use m
20 type(t) :: x
21 character(len=4) :: str
22 x%ptr => abc
23 print *,x%ptr(4)
24 if (x%ptr(4)/='abcd') call abort
25 str = x%ptr(3)
26 if (str/='abc') call abort()
27 end
29 ! { dg-final { cleanup-modules "m" } }