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

program hangs when using DEALLOCATE

whistles28
Beginner
1,267 Views
Hi!

I am new here. I use the ifort compiler in with a Xeon based computer (well, actually a cluster but I use only one computer).
Does anyone know what can be happening when my fortran program just hangs at one DEALLOCATE(this_is_an_array) statement?

I checked the state of the array just before the statement and it is allocated
I even wrote

DEALLOCATE(this_is_an_array, STAT=x)
Write(*,*) x

but x never gets to be written.It hangs before this.

the array was defined as allocatable in an external module an later it was allocated in a subroutine.

Is there any compilation option which will allow me to know what's happening?

Thanks,
Francisco
0 Kudos
3 Replies
TimP
Honored Contributor III
1,267 Views
Quoting - whistles28

DEALLOCATE(this_is_an_array, STAT=x)
Write(*,*) x

but x never gets to be written.It hangs before this.

the array was defined as allocatable in an external module an later it was allocated in a subroutine.

Is there any compilation option which will allow me to know what's happening?

Such as IMPLICIT NONE, to assure that you don't fail to declare INTEGER x ? or -check, to perform several run-time checks?
0 Kudos
whistles28
Beginner
1,267 Views
Quoting - tim18
Such as IMPLICIT NONE, to assure that you don't fail to declare INTEGER x ? or -check, to perform several run-time checks?
As for the IMPLICIT NONE I always use it and therefore it shouldn' be the case.

I am now using -check all - and there are lots of other issues appearing before the problem I described. After I solve these issues I hope I will be able to understand what's wrong with the DEALLOCATE statement. I'll report the result later.

Thanks for the tip!
0 Kudos
whistles28
Beginner
1,267 Views
Quoting - whistles28
As for the IMPLICIT NONE I always use it and therefore it shouldn' be the case.

I am now using -check all - and there are lots of other issues appearing before the problem I described. After I solve these issues I hope I will be able to understand what's wrong with the DEALLOCATE statement. I'll report the result later.

Thanks for the tip!
Problem solved:

The problem was that I had some variables which were used before they were initialized and the arrays related to them became inconsistent. By activating the -check option I managed to detect these problems and correct them.

Thanks again!
Francisco
0 Kudos
Reply