| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Test fix for PR60795 comments #1 and #4 |
| 4 |
! |
| 5 |
! Contributed by Kergonath <[email protected]> |
| 6 |
! |
| 7 |
module m |
| 8 |
contains |
| 9 |
subroutine allocate_array(s_array) |
| 10 |
character(:), dimension(:), allocatable, intent(out) :: s_array |
| 11 |
|
| 12 |
allocate(character(2) :: s_array(2)) |
| 13 |
s_array = ["ab","cd"] |
| 14 |
end subroutine |
| 15 |
end module |
| 16 |
|
| 17 |
program stringtest |
| 18 |
use m |
| 19 |
character(:), dimension(:), allocatable :: s4 |
| 20 |
character(:), dimension(:), allocatable :: s |
| 21 |
! Comment #1 |
| 22 |
allocate(character(1) :: s(10)) |
| 23 |
if (size (s) .ne. 10) STOP 1 |
| 24 |
if (len (s) .ne. 1) STOP 2 |
| 25 |
! Comment #4 |
| 26 |
call allocate_array(s4) |
| 27 |
if (size (s4) .ne. 2) STOP 3 |
| 28 |
if (len (s4) .ne. 2) STOP 4 |
| 29 |
if (any (s4 .ne. ["ab", "cd"])) STOP 5 |
| 30 |
end program |