view gcc/testsuite/gfortran.dg/deferred_type_param_4.f90 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! { dg-do run }
!
! PR fortran/51055
! PR fortran/49110
!
!
program test
  implicit none
  character(len=:), allocatable :: str
  integer :: i
  i = 5
  str = f()
  call printIt ()
  i = 7
  str = repeat('X', i)
  call printIt ()
contains
  function f()
    character(len=i) :: f
    f = '1234567890'
  end function f
  subroutine printIt
!    print *, len(str)
!    print '(3a)', '>',str,'<'
    if (i == 5) then
      if (str /= "12345" .or. len(str) /= 5) call abort ()
    else if (i == 7) then
      if (str /= "XXXXXXX" .or. len(str) /= 7) call abort ()
    else
      call abort ()
    end if
  end subroutine
end