Debian Codegraph @

gcc/testsuite/gfortran.dg/actual_array_substr_1.f90

raw
1 ! { dg-do run }
2 ! Test fix of PR28118, in which a substring reference to an
3 ! actual argument with an array reference would cause a segfault.
4 !
5 ! Contributed by Paul Thomas <[email protected]>
6 !
7 program gfcbug33
8 character(12) :: a(2)
9 a(1) = "abcdefghijkl"
10 a(2) = "mnopqrstuvwx"
11 call foo ((a(2:1:-1)(6:)))
12 call bar ((a(:)(7:11)))
13 contains
14 subroutine foo (chr)
15 character(7) :: chr(:)
16 if (chr(1)//chr(2) .ne. "rstuvwxfghijkl") STOP 1
17 end subroutine foo
18 subroutine bar (chr)
19 character(*) :: chr(:)
20 if (trim(chr(1))//trim(chr(2)) .ne. "ghijkstuvw") STOP 2
21 end subroutine bar
22 end program gfcbug33