c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / multiple_allocation_3.f90
blob06e996b779697ed3180221745df75d5bc76a5f87
1 ! { dg-do run }
2 ! PR 49755 - If allocating an already allocated array, and stat=
3 ! is given, set stat to non zero and do not touch the array.
4 program test
5 integer, allocatable :: A(:, :)
6 integer :: stat
8 allocate(A(20,20))
9 A = 42
11 ! Allocate of already allocated variable
12 allocate (A(5,5), stat=stat)
14 ! Expected: Error stat and previous allocation status
15 if (stat == 0) STOP 1
16 if (any (shape (A) /= [20, 20])) STOP 2
17 if (any (A /= 42)) STOP 3
18 end program