| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Contributed by Rich Townsend <[email protected]> |
| 4 |
! |
| 5 |
program alloc_char_type |
| 6 |
implicit none |
| 7 |
integer, parameter :: start = 1, finish = 4 |
| 8 |
character(3) :: check(4) |
| 9 |
type mytype |
| 10 |
character(:), allocatable :: c(:) |
| 11 |
end type mytype |
| 12 |
type(mytype) :: a |
| 13 |
type(mytype) :: b |
| 14 |
integer :: i |
| 15 |
a%c = ['foo','bar','biz','buz'] |
| 16 |
check = ['foo','bar','biz','buz'] |
| 17 |
b = a |
| 18 |
do i = 1, size(b%c) |
| 19 |
if (b%c(i) .ne. check(i)) stop 1 |
| 20 |
end do |
| 21 |
if (any (a%c .ne. check)) stop 2 |
| 22 |
if (any (a%c(start:finish) .ne. check)) stop 3 |
| 23 |
deallocate (a%c) |
| 24 |
deallocate (b%c) |
| 25 |
end |