view gcc/testsuite/gfortran.dg/submodule_23.f90 @ 152:2b5abeee2509

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

! { dg-do compile }
!
! Test the fix for PR79402, in which the module procedure 'fun1' picked
! up a spurious symbol for the dummy 'n' in the specification expression
! for the result 'y'.
!
! Contributed by Chris Coutinho  <chrisbcoutinho@gmail.com>
!
module mod
  interface myfun
    module function fun1(n) result(y)
      integer,  intent(in)    :: n
      real, dimension(n)  :: y
    end function fun1
  end interface myfun

end module mod

submodule (mod) submod
contains
  module procedure fun1
    integer :: i
    y = [(float (i), i = 1, n)]
  end procedure fun1
end submodule

  use mod
  print *, fun1(10)
end