OSDN Git Service

2011-09-26 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / proc_ptr_22.f90
1 ! { dg-do run }
2 !
3 ! PR 40646: [F03] array-valued procedure pointer components
4 !
5 ! Original test case by Charlie Sharpsteen <chuck@sharpsteen.net>
6 ! Modified by Janus Weil <janus@gcc.gnu.org>
7
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
18
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
28
29 ! { dg-final { cleanup-modules "bugtestmod" } }
30