2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / generic_21.f90
blobb11aa7facf0bbea83a62d75aa51e2c10348834ec
1 ! { dg-do compile }
3 ! PR fortran/42858
5 ! Contributed by Harald Anlauf
7 module gfcbug102
8 implicit none
9 type t_vector_segm
10 real ,pointer :: x(:) => NULL()
11 end type t_vector_segm
13 type t_vector
14 integer :: n_s = 0
15 type (t_vector_segm) ,pointer :: s (:) => NULL()
16 end type t_vector
18 interface sqrt
19 module procedure sqrt_vector
20 end interface sqrt
22 contains
23 function sqrt_vector (x) result (y)
24 type (t_vector) :: y
25 type (t_vector) ,intent(in) :: x
26 integer :: i
27 do i = 1, y% n_s
28 y% s(i)% x = sqrt (x% s(i)% x)
29 end do
30 end function sqrt_vector
31 end module gfcbug102