2 ! PR52012 - tests of automatic reallocation on assignment for variable = array_intrinsic
4 ! Contributed by Tobias Burnus and Dominique Dhumieres
6 integer, allocatable
:: a(:), b(:), e(:,:)
7 integer :: c(1:5,1:5), d(1:5,1:5)
11 ! Shape conforms so bounds follow allocation.
13 a
= reshape( b
, shape
=[size(b
)])
14 if (any ([lbound(a
), ubound(a
), size(a
), shape (a
)] .ne
. [7,9,3,3])) call abort
17 ! 'a' not allocated so lbound defaults to 1.
18 a
= reshape( b
, shape
=[size(b
)])
19 if (any ([lbound(a
), ubound(a
), size(a
), shape (a
)] .ne
. [1,3,3,3])) call abort
22 ! Shape conforms so bounds follow allocation.
25 if (any ([lbound(a
), ubound(a
), size(a
), shape (a
)] .ne
. [0,0,1,1])) call abort
27 ! 'a' not allocated so lbound defaults to 1.
28 e
= matmul (c(2:5,:), d(:, 3:4))
29 if (any ([lbound(e
), ubound(e
), size(e
), shape (e
)] .ne
. [1,1,4,2,8,4,2])) call abort
32 ! Shape conforms so bounds follow allocation.
33 allocate (e(4:7, 11:12))
34 e
= matmul (c(2:5,:), d(:, 3:4))
35 if (any ([lbound(e
), ubound(e
), size(e
), shape (e
)] .ne
. [4,11,7,12,8,4,2])) call abort