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
32
33
34
35
36
37
38
39
40
41
42
|
! { dg-do run }
!
! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
!
module m
type t
contains
generic :: h => g
procedure, private :: g
end type
contains
function g(x, y) result(z)
class(t), intent(in) :: x
real, intent(in) :: y(:, :)
real :: z(size(y, 2))
integer :: i
do i = 1, size(y, 2)
z(i) = i
end do
end
end
module m2
use m
type t2
class(t), allocatable :: u(:)
end type
end
use m2
type(t2) :: x
real :: y(1,5)
allocate (x%u(1))
if (any (int(f (x, y)) .ne. [1,2,3,4,5])) stop 1
deallocate (x%u)
contains
function f(x, y) result(z)
use m2
type(t2) :: x
real :: y(:, :)
real :: z(size(y, 2))
z = x%u(1)%h(y) ! Used to segfault here
end
end
|