aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pdt_12.f03
blob: 729b023eff89e0c3d7c81ec1d0c1c65e77a1f7d3 (plain)
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 }
!
! Checks PDTs with ASSOCIATE.
! Was failing for same reason as PR60483.
!
! Contributed by Reinhold Bader  <reinhold.bader@lrz.de>
!
module matrix_mod_assumed_05

  implicit none

  type :: matrix(rk, n, m)
     integer, kind :: rk
     integer, len :: n, m
     real(rk) :: entry(n, m)
  end type matrix
  integer, parameter :: rk=kind(1.d0)
  integer :: mm=20, nn=15

contains
  function factory()
    type(matrix(rk, :, :)), allocatable :: factory
    allocate(matrix(rk, nn, mm) :: factory)
  end function
end module

program test

  use matrix_mod_assumed_05
  implicit none

  associate (o_matrix => factory())
    if (o_matrix%n == nn .and. o_matrix%m == mm) then  ! Symbol 'o_matrix' at (1) has no IMPLICIT type
     write(*,*) 'OK'
    else
     write(*,*) 'FAIL'
     STOP 1
    end if
  end associate

end program test