annotate gcc/testsuite/gfortran.dg/multiple_allocation_3.f90 @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 ! PR 49755 - If allocating an already allocated array, and stat=
kono
parents:
diff changeset
3 ! is given, set stat to non zero and do not touch the array.
kono
parents:
diff changeset
4 program test
kono
parents:
diff changeset
5 integer, allocatable :: A(:, :)
kono
parents:
diff changeset
6 integer :: stat
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 allocate(A(20,20))
kono
parents:
diff changeset
9 A = 42
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 ! Allocate of already allocated variable
kono
parents:
diff changeset
12 allocate (A(5,5), stat=stat)
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 ! Expected: Error stat and previous allocation status
kono
parents:
diff changeset
15 if (stat == 0) call abort ()
kono
parents:
diff changeset
16 if (any (shape (A) /= [20, 20])) call abort ()
kono
parents:
diff changeset
17 if (any (A /= 42)) call abort ()
kono
parents:
diff changeset
18 end program
kono
parents:
diff changeset
19