Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Allocation and Deallocation errors

killjoy
Beginner
691 Views

Hi,

I was wondering if this is code error, or a bug error. I have two problems with the following code,

subroutine inverse(A,B)
implicit none
real, intent(in)::A(:,:)
real, intent(out)::B(:,:)
real, allocatable::I(:,:), L(:,:)
real, allocatable:: Demands(:,:), Results(:,:)
integer::j, number_of_rows, y, z

number_of_rows = size(A(:,1))
allocate(L(number_of_rows,number_of_rows))

allocate(I(number_of_rows,number_of_rows))
allocate(Demands(number_of_rows,1))
allocate(Results(number_of_rows,1))
B=0
I=0
L= A
do j=1,number_of_rows
I(j,j)=1
end do
do j=1, number_of_rows
Demands(:,j)= I(:,j) !****Not assigning
!Intent(Inout, Inout)
call GaussElim(L, Demands)
!Intent(In, In, Out)
call BackwardSubstitution(L, Demands, Results)
B(:,j)=Results(:,1)
L=A

end do
deallocate(I)
deallocate(Demands)
deallocate(Results)
end subroutine inverse

The subroutine runs through to its end but finishes by printing a

Deallocate error 493: Variable was not created by ALLOCATE

End of diagnostics

Secondly each time through the do loop, Demands should be set to the next column of the Identity Matrix, however this line is seemingly ignored for j >= 2. I can't see why

Is their something which I am doing wrong ?

Thanks Killjoy

0 Kudos
1 Reply
Steven_L_Intel1
Employee
691 Views
I can't really tell what is going on without a runnable example. I suggest filing a support request with Intel Premier Support and including a self-contained example that reproduces the problem. Before doing that, you should download and install the latest compiler build from Premier Support, if you have a support license, and try that. Even without a support license, you can still submit problem reports.

Steve
0 Kudos
Reply