The following piece of code thorws a run-time error in my code and I do not understand why, since what I do seems to be standard to me and is done at many other positions in my code wihtout problem. Moreover the code is been used for 5 years now with an older compiler version without any problems.
The error appears only in the release version with maximal speed optimization.
! variables: Reference is a own structure holding a logical member "Master" Type(Reference), pointer :: pReference ! execute that throws a run-time exception only in release version if maximize speed optimization is enabled: ! namely: "Attempt to use pointer pReference when it is nit associated with a target" pReference => Null() allocate(pReference, stat = ierr(1)) if (ierr(1) .NE. 0) then my_status = 3 if(present(STATUS)) STATUS = my_status return end if if(associated( pReference)) then ! set flag pReference%Master = .FALSE. end if
As I said the error appears only in the release version so it is hard to judge what actually happens. But even inside the if clause where I checked if the pointer is associated another if clause checking the same statement will tell me that this is not the case... which obvioulsy cannot be true otherwise the code would no enter the clause.
Thanks everybody for your help!
Regards,
Felix


