Paul
Sorry for the delayed response. But I am seeing here the good discussions by our experts, Thanks to all of them and they are very supportive to strengthen FTN95.
Pls. find my answers below on the dangling Fortran pointer. I have checked as you said. Below are my observations.
Quoted from PaulLaidler
Moorthy
- Try commenting out this line to see if the following lines are OK.
- Where is this array allocated? Is it correct to deallocate at this point?
- I am guessing that you are using /CHECK. What happens without it?
- Maybe there is a potential bug in FTN95/salflibc.dll. If so then we would need a short working sample in order to fix it.
Please read below '[xxx]' as button displayed with 'xxx'.
- I have commented all the DEALLOCATE statements. There are 4 arrays (BS,LIN,TRFR,HDR), where it is failing to deallocate, but it showed the following error message first and then if you continue further, it was showing the 2nd error message. This I have tested during DEBUG mode of running the code.
Error Message 1:
System Exception 0x40010008: Format Message Failed
[Break] [Continue] (On clicking Continue Button, Error Message 2 displayed below)
Error Message 2:
Error: Attempt to DEALLOCATE dangling Fortran POINTER
[Break] [Continue]
It is then showing salflibc.dll error page saying the PDB does not exist.. etc.
- Yes. I am using /CHECK option while compiling and getting the above Errors. If I complile without /CHECK, I get the following RunTime Error message directly
Error Message 3:
Run-time Error:
Error: Attempt to DEALLOCATE dangling Fortran POINTER
main - in file 01_symmatmain.f95 at line 900 [+0be4]
[SaveAs] [Details] [Close]
- For the 2 above, I got the above 'Error Message 3', while executing the EXE file. In all these cases, compiling and building executable were done successfully.
While on this, as mentioned above, there are 4 arrays, which are unallocatable, are also allocated in the MODULE itself as 'ALLOCATABLE'. Pls. see the syntax used in Module.
module SYMMATRIXGLOBALMASTER
TYPE (BUS), DIMENSION (:), allocatable,target :: BS, BS1, BS2
TYPE (LINE), DIMENSION (:), allocatable,target :: LIN, LIN1, LIN2
TYPE (TRAFO), DIMENSION (:), allocatable,target :: TRFR, TRFR1, TRFR2
TYPE (HEADER), DIMENSION(:), allocatable,target :: HDR,HDR2
contains
.....
end module SYMMATRIXGLOBALMASTER
In the above, as I said, there are 4 arrays which are UNALLOCATABLE: BS, LIN, TRFR and HDR. While on this, the remaining arrays were successfully unallocated. But these 4 arrays are the culprits. Hence, these issues of 'DEALLOCATE Dangling FORTRAN POINTER' error has occured. But if you closely examine each of the TYPE statements, there are 3 arrays, out of which first one is the culprit, while the rest of the arrays are deallocated. In all these 4 user types, the same trend is followed. Can you make out, anything in common from FTN95 perspectives.?
- I can provide a sample code from this one, by extracting a smaller code out of my bigger program, which I will prepare and send it separately.
In the meantime, an another sample given by mecej4 in another thread on the same subject, is also useful to showcase this error. Pls. refer to this link http://forums.silverfrost.com/posting.php?mode=quote&p=23939
I am reproducing the same example here below: (Thanks to mecej4)
But I am unable to paste the code here, due to site word limitations. Please refer to the link given above.