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

Problem with DEALLOCATE

Intel_C_Intel
Employee
343 Views
I have a user using ALLOCATABLE arrays in a FORTRAN DLL. As far as I can tell, he has set up the ALLOCATION correctly, but is having problems with DEALLOCATE at the end of the routine.

The first DEALLOCATE statement brings up the following message:

Debug Error!
Program: C:Program Fileslah blah
DAMAGE: After normal block (#63) at 0x025c2828

(Press Retry To Debug Application)

Abort Retry Ignore

The normal block number and memory address can change.
If I 'Ignore' execution proceeds without further errora but the following message is written to the debug output in devstudio:

memory check error at 0x025C2828 = 0x00 should be 0xfd

I've never had this problem using allocatable arrays before...any ideas anyone?

(Can avoid the error by not explicitly deallocating, but that isn't good form is it?)
0 Kudos
3 Replies
Intel_C_Intel
Employee
343 Views
The user is passing the allocatable arrays and their sizes (n) to sub-functions, where the arrays are locally defined to be of size (n). Could this cause any problems?
0 Kudos
Jugoslav_Dujic
Valued Contributor II
343 Views
This alone shouldn't; it all looks like array bounds violation. However, note that CVF cannot detect array out of bounds exceptions for assumed-size arrays. My guess is that the routines write into (most probably) array(0), which does not cause a run-time exception, but rather just silently corrupts the heap -- it gets detected just on DEALLOCATE.

If you convert the arguments to assumed-size (:) CVF will be able to detect array bounds exceeded (however, note that it requires having explicit interfaces to the callees).

Jugoslav
0 Kudos
Intel_C_Intel
Employee
343 Views
Jugoslav,

It was an array-bounds problem. Well several actually. Once I turned array-bound checking on, everything worked out (i.e. the debugger 'exceptioned' in the right places)!

Cheers,

Dan
0 Kudos
Reply