| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fcheck=bounds" } |
| 3 |
! |
| 4 |
! PR fortran/87045 - pointer to array of character |
| 5 |
! Contributed by Valery Weber |
| 6 |
! This used to give an invalid run-time error |
| 7 |
|
| 8 |
program test |
| 9 |
character(:), dimension(:), allocatable, target :: t |
| 10 |
character(:), pointer, dimension(:) :: p |
| 11 |
allocate( character(3) :: t(2) ) |
| 12 |
t(1) = "abc" |
| 13 |
t(2) = "123" |
| 14 |
p => t |
| 15 |
if (size (p) /= 2) stop 1 |
| 16 |
if (len (p) /= 3) stop 2 |
| 17 |
if (p(1) /= "abc") stop 3 |
| 18 |
if (p(2) /= "123") stop 4 |
| 19 |
end program test |