| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Check the test for PR69422, in which the allocatable component 'Source' |
| 4 |
! of the pointer component 'P' was not automatically (re)allocated on |
| 5 |
! assignment. |
| 6 |
! |
| 7 |
! Contributed by Anthony Lewis <[email protected]> |
| 8 |
! |
| 9 |
module funcs |
| 10 |
implicit none |
| 11 |
|
| 12 |
Type T |
| 13 |
character(LEN=:), allocatable :: source |
| 14 |
end type T |
| 15 |
|
| 16 |
type TPointer |
| 17 |
Type(T), pointer :: P |
| 18 |
end type TPointer |
| 19 |
|
| 20 |
end module |
| 21 |
|
| 22 |
program Test1 |
| 23 |
use funcs |
| 24 |
Type(TPointer) :: X |
| 25 |
|
| 26 |
allocate(X%P) |
| 27 |
|
| 28 |
X%P%Source = 'test string' |
| 29 |
if (.not.allocated (X%P%Source)) STOP 1 |
| 30 |
if (X%P%Source .ne. 'test string') STOP 2 |
| 31 |
|
| 32 |
end program Test1 |