Debian Codegraph @

gcc/testsuite/gfortran.dg/pdt_12.f03

raw
1 ! { dg-do run }
2 !
3 ! Checks PDTs with ASSOCIATE.
4 ! Was failing for same reason as PR60483.
5 !
6 ! Contributed by Reinhold Bader <[email protected]>
7 !
8 module matrix_mod_assumed_05
9
10 implicit none
11
12 type :: matrix(rk, n, m)
13 integer, kind :: rk
14 integer, len :: n, m
15 real(rk) :: entry(n, m)
16 end type matrix
17 integer, parameter :: rk=kind(1.d0)
18 integer :: mm=20, nn=15
19
20 contains
21 function factory()
22 type(matrix(rk, :, :)), allocatable :: factory
23 allocate(matrix(rk, nn, mm) :: factory)
24 end function
25 end module
26
27 program test
28
29 use matrix_mod_assumed_05
30 implicit none
31
32 associate (o_matrix => factory())
33 if (o_matrix%n == nn .and. o_matrix%m == mm) then ! Symbol 'o_matrix' at (1) has no IMPLICIT type
34 write(*,*) 'OK'
35 else
36 write(*,*) 'FAIL'
37 STOP 1
38 end if
39 end associate
40
41 end program test
42