aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/generic_21.f90
blob: b11aa7facf0bbea83a62d75aa51e2c10348834ec (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
31
! { dg-do compile }
!
! PR fortran/42858
!
! Contributed by Harald Anlauf
!
module gfcbug102
  implicit none
  type t_vector_segm
     real ,pointer :: x(:) => NULL()
  end type t_vector_segm

  type t_vector
     integer                       :: n_s     =  0
     type (t_vector_segm) ,pointer :: s (:)   => NULL()
  end type t_vector

  interface sqrt
     module procedure sqrt_vector
  end interface sqrt

contains
  function sqrt_vector (x) result (y)
    type (t_vector)             :: y
    type (t_vector) ,intent(in) :: x
    integer :: i
    do i = 1, y% n_s
       y% s(i)% x = sqrt (x% s(i)% x)
    end do
  end function sqrt_vector
end module gfcbug102