Silverfrost Forums

Welcome to our forums

ALLOCATE halts the execution

27 Oct 2013 9:30 #13235

Hi all, I'm making a strange observation, which I cannot reproduce in a short test program (below), which runs well however. I'm allocating and deallocating arrarys in a loop with dynamic file size. My 'large' program halts, without any notice or message, at allocate in the second call of sub. All previous allocates and deallocates return a STAT value of 0.

MODULE common
Real,Allocatable :: A(:,:)
END Module

PROGRAM alloctest
USE common
1 continue
ALLOCATE (A(10,10))
print *,'Allocated'
A=12345.
print *,'Now deallocate'
DEALLOCATE (A)
print *,'Allocated again'
ALLOCATE (A(20,20))
print *,'Now deallocate'
DEALLOCATE (A)
CALL sub()
pause 'next lap'
goto 1
END
Subroutine sub()
USE common
print *,'sub called.'
print *,'Allocated again'
ALLOCATE (A(5,5))
print *,'Now deallocate'
DEALLOCATE (A)
print *,'sub left'
RETURN
END

I have to add that I use third-party widget routines and call-back functions.

What I want to know is, how to get any diagnostic information. Best regards, johannes

27 Oct 2013 3:11 #13238

What is the IOSTAT value on failure?

28 Oct 2013 2:19 #13241

Hi Paul, there is no failure before this special weired allocate. All previous STAT had been 0. I was wondering whether ALLOCATABLE inside a module and subsequent frequent changes in array dimensions could be a problem, but the little test routine runs well. That looks strange to me.

28 Oct 2013 2:46 #13242

But what is the IOSTAT value after the ALLOCATE that fails. It should be non-zero but what is this non-zero value?

28 Oct 2013 4:03 #13243

There is no 'after'. It stops at allocation, as if it was waiting for some input. The test print after allocate is no more executed. The array size is small and no activities in the task manager are visible.

28 Oct 2013 5:04 #13244

Have you tried using the debugger to run to the point at which it fails?

28 Oct 2013 5:21 #13245

Hi Paul, just done. There seems to be a problem in the call back djungle. I think you answered my question about more diagnostics. Thanks johannes PS: Let me delete this request somewhen later

Please login to reply.