comparison gcc/testsuite/gfortran.dg/pr92208.f90 @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 ! { dg-do run }
2 !
3 ! PR fortran/92208
4 !
5 ! Contributed by Nils Reiche
6 !
7 program stringtest
8 implicit none
9 integer, parameter :: noVars = 2
10
11 ! print*, "varNames: ", createVarnames("var",noVars)
12 call function1(noVars,createVarnames("var",noVars),"path")
13
14 contains
15
16 function createVarnames(string,noVars) result(stringArray)
17 implicit none
18 character(len=*), intent(in) :: string
19 integer, intent(in) :: noVars
20 character(len=len_trim(string)+6), dimension(noVars) :: stringArray
21 integer :: i
22 do i=1,noVars
23 write(stringArray(i),'(a,i0)') string, i
24 enddo
25 end function createVarnames
26
27 subroutine function1(noVars,varNames,path)
28 implicit none
29 integer, intent(in) :: noVars
30 character(len=*), intent(in) :: path
31 character(len=*), dimension(noVars) :: varNames
32
33 if (path /= 'path') stop 1
34 if (any(varNames /= ['var1', 'var2'])) stop 2
35 !print*, "function1-path : ", trim(path)
36 !print*, "function1-varNames: ", varNames
37 end subroutine function1
38
39 end program stringtest