| 1 |
! { dg-do run } |
| 2 |
! PR52012 - with realloc_lhs active(ie. default condition) the |
| 3 |
! offset was wrongly calculated for a, after assignment. |
| 4 |
! |
| 5 |
! Reported by Reinhold Bader and Tobias Burnus <[email protected]> |
| 6 |
! |
| 7 |
program gf |
| 8 |
implicit none |
| 9 |
real, allocatable :: a(:,:,:) |
| 10 |
real, parameter :: zero = 0.0, one = 1.0 |
| 11 |
real :: b(3,4,5) = zero |
| 12 |
b(1,2,3) = one |
| 13 |
allocate (a(size (b, 3), size (b, 2), size (b, 1))) |
| 14 |
a = reshape (b, shape (a), order = [3, 2, 1]) |
| 15 |
if (any (a(:, 2, 1) .ne. [zero, zero, one, zero, zero])) STOP 1 |
| 16 |
if (a(3, 2, 1) /= one) STOP 1 |
| 17 |
if (sum (abs (a)) /= one) STOP 2 |
| 18 |
end program |