Commit 64fd682d authored by Budiardja, Reuben's avatar Budiardja, Reuben
Browse files

Test for Allocate with MOLD.

parent a42d6d42
program A_M
implicit none
real, dimension ( : ), allocatable :: &
A, B
allocate ( A ( 0 : 5 ) )
call Init ( A )
contains
subroutine Init ( A )
real, dimension ( 0 : ), intent ( in ) :: &
A
integer, dimension ( 1 ) :: &
S_A, S_B, &
lb_A, lb_B, &
ub_A, ub_B
print*, 'Allocating B with mold = A'
allocate ( B, mold = A )
S_A = shape ( A )
S_B = shape ( B )
lb_A = lbound ( A )
lb_B = lbound ( B )
ub_A = ubound ( A )
ub_B = ubound ( B )
if ( all ( S_A == S_B ) .and. all ( lb_A == lb_B ) &
.and. all ( ub_A == ub_B ) ) then
print*, 'PASSED'
else
print*, 'FAILED'
print*, 'Shape A, B', S_A
print*, 'lower, upper bound of A', lb_A, ub_A
print*, 'lower, upper bound of B', lb_B, ub_B
end if
end subroutine Init
end program A_M
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment