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

Deallocate causes code crash

eleteroboltz
Beginner
369 Views

Hey guys... I am stuck on this problem for days. My code is crashing but I can't understand the reason why.

I realized that the compiled program crashes when it is deallocating the variables, but I don't know how to fix it.

Windows has triggered a breakpoint in Console1.exe.

This may be due to a corruption of the heap, which indicates a bug in Console1.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while Console1.exe has focus.

The output window may have more diagnostic information.

Bellow there is a sample of the code:

Subroutine PoissonCode()
Use Mesh
Implicit none
Real(8), Allocatable :: u(:,:),v(:,:),p(:,:)
Character(50) :: Nome
Allocate(u(0:Imax,0:jmax),v(0:Imax,0:jmax),p(0:Imax,0:jmax),fx(0:Imax,0:jmax),fy(0:Imax,0:jmax))
Allocate(xd(0:Imax),yd(0:Jmax))

........Code Here...............

Deallocate(u,v,p,fx,fy)
Deallocate(xd,yd)

End Subroutine PoissonCode

I put the complete code here for further investigation. I also tried to run the code with different versions of GFortran in Windows 7 x64 and Windows XP x86 with no success.

Thank you in advance

0 Kudos
2 Replies
Steven_L_Intel1
Employee
369 Views

The Dropbox link doesn't work.

0 Kudos
eleteroboltz
Beginner
369 Views

Sorry...

Actually I already solved this issue. The problem was that in my code, I was trying to modify, by mistake, an invalid array position.

Thank you

0 Kudos
Reply