summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr57910.f90
blob: c3666a6fcd8978f7d2bf93366c6f0965c32ba855 (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
! { dg-do run }
program strtest

  implicit none

  character(len=:), allocatable:: my_str

  integer, parameter :: slen_init = 7
  integer :: slen = slen_init

  my_str = fstr(slen)
  if (slen /= slen_init .or. len(my_str) /= slen .or. my_str /= ' ') then
    call abort
  endif

contains

  function fstr(strlen)
    integer, value :: strlen
    character(len=strlen)::fstr

    strlen = 17  ! Make sure strlen was really passed by value
    fstr = ' '
  end function fstr

end program strtest