| 1 |
! { dg-do compile } |
| 2 |
! PR fortran/112764 |
| 3 |
! Contributed by martin <[email protected]> |
| 4 |
|
| 5 |
program assoc_target |
| 6 |
implicit none |
| 7 |
integer, dimension(:,:), pointer :: x |
| 8 |
integer, pointer :: j |
| 9 |
integer, allocatable, target :: z(:) |
| 10 |
allocate (x(1:100,1:2), source=1) |
| 11 |
associate (i1 => x(:,1)) |
| 12 |
j => i1(1) |
| 13 |
print *, j |
| 14 |
if (j /= 1) stop 1 |
| 15 |
end associate |
| 16 |
deallocate (x) |
| 17 |
allocate (z(3)) |
| 18 |
z(:) = [1,2,3] |
| 19 |
associate (i2 => z(2:3)) |
| 20 |
j => i2(1) |
| 21 |
print *, j |
| 22 |
if (j /= 2) stop 2 |
| 23 |
end associate |
| 24 |
deallocate (z) |
| 25 |
end program assoc_target |