view gcc/testsuite/gfortran.dg/pdt_12.f03 @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { 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