| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR fortran/42858 |
| 4 |
! |
| 5 |
! Contributed by Harald Anlauf |
| 6 |
! |
| 7 |
module gfcbug102 |
| 8 |
implicit none |
| 9 |
type t_vector_segm |
| 10 |
real ,pointer :: x(:) => NULL() |
| 11 |
end type t_vector_segm |
| 12 |
|
| 13 |
type t_vector |
| 14 |
integer :: n_s = 0 |
| 15 |
type (t_vector_segm) ,pointer :: s (:) => NULL() |
| 16 |
end type t_vector |
| 17 |
|
| 18 |
interface sqrt |
| 19 |
module procedure sqrt_vector |
| 20 |
end interface sqrt |
| 21 |
|
| 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 |