gcc/fortran/
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_22.f90
blob69d165e33a80ac1fe8a0ba2149f6bbc611654c59
1 ! { dg-do run }
3 ! PR 40646: [F03] array-valued procedure pointer components
5 ! Original test case by Charlie Sharpsteen <chuck@sharpsteen.net>
6 ! Modified by Janus Weil <janus@gcc.gnu.org>
8 module bugTestMod
9 implicit none
10 procedure(returnMat), pointer :: pp2
11 contains
12 function returnMat( a, b ) result( mat )
13 integer:: a, b
14 double precision, dimension(a,b):: mat
15 mat = 1d0
16 end function returnMat
17 end module bugTestMod
19 program bugTest
20 use bugTestMod
21 implicit none
22 procedure(returnMat), pointer :: pp
23 pp => returnMat
24 if (sum(pp(2,2))/=4) call abort()
25 pp2 => returnMat
26 if (sum(pp2(3,2))/=6) call abort()
27 end program bugTest