| 1 |
! { dg-do run } |
| 2 |
! PR 15234 |
| 3 |
! tests for passing arrays of assumed length characters |
| 4 |
program strarray_6 |
| 5 |
character(5), dimension(:), allocatable :: c |
| 6 |
n = 3 |
| 7 |
allocate(c(-1:n-2)) |
| 8 |
c = "BLUBB" |
| 9 |
call foo(c) |
| 10 |
call bar(c,n) |
| 11 |
deallocate(c) |
| 12 |
contains |
| 13 |
subroutine foo(x) |
| 14 |
character (len = *), dimension(:) :: x |
| 15 |
if (any (x .ne. "BLUBB")) STOP 1 |
| 16 |
end subroutine foo |
| 17 |
end |
| 18 |
|
| 19 |
subroutine bar(x,n) |
| 20 |
character (len = *), dimension(n) :: x |
| 21 |
if (any (x .ne. "BLUBB")) STOP 2 |
| 22 |
end subroutine bar |