fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / generic_21.f90
blobc651e63942790917219ce9e388598d960ef39d10
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
33 ! { dg-final { cleanup-modules "gfcbug102" } }