Daily bump.
[official-gcc.git] / gcc / testsuite / gfortran.dg / realloc_on_assign_10.f90
blobd5883d41f6eb021bd735c00ac885522ab8b57e3c
1 ! { dg-do run }
2 ! PR52012 - with realloc_lhs active(ie. default condition) the
3 ! offset was wrongly calculated for a, after assignment.
5 ! Reported by Reinhold Bader and Tobias Burnus <burnus@gcc.gnu.org>
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