summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/proc_ptr_22.f90
blob: 3b1f5c64e8bb4b1030be2b06fb6de0fb173989f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
! { dg-do run }
!
! PR 40646: [F03] array-valued procedure pointer components
!
! Original test case by Charlie Sharpsteen <chuck@sharpsteen.net>
! Modified by Janus Weil <janus@gcc.gnu.org>

module bugTestMod
  implicit none
  procedure(returnMat), pointer :: pp2
contains
  function returnMat( a, b ) result( mat )
    integer:: a, b
    double precision, dimension(a,b):: mat 
    mat = 1d0
  end function returnMat
end module bugTestMod

program bugTest
  use bugTestMod
  implicit none
  procedure(returnMat), pointer :: pp
  pp => returnMat
  if (sum(pp(2,2))/=4) call abort()
  pp2 => returnMat
  if (sum(pp2(3,2))/=6) call abort()
end program bugTest

! { dg-final { cleanup-modules "bugTestMod" } }