2011-05-23 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / actual_array_substr_1.f90
blob90108ec35cbbcfdcb21ceec5feed249a2a4d9462
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.
5 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
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") call abort ()
17 end subroutine foo
18 subroutine bar (chr)
19 character(*) :: chr(:)
20 if (trim(chr(1))//trim(chr(2)) .ne. "ghijkstuvw") call abort ()
21 end subroutine bar
22 end program gfcbug33