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

What causes an assertion failure?

Intel_C_Intel
Employee
2,047 Views
In a program that I am working on, I get the following error:

Debug Assertion Failed!
Program: TAGenPro.exe
File: dbgheap.c
Line: 1044

Expression: _CrtIsValidHeapPointer(pUserData)

It occurs at the line:
DEALLOCATE( NODE%NODE , STAT=STATUS)

where NODE is a linked list. I believe that the NODE being deallocated in the statement was also the target of a previous pointer, and has already been deallocated. However, it seems that if this is the case, then the STAT should catch this anyway.

Am I on the right track? Can anyone suggest anything? (CVF6.6a, Win2k)

Matt.

0 Kudos
4 Replies
Steven_L_Intel1
Employee
2,047 Views
What is happening is that the Debug version of the Visual C++ RTL is detecting that a block of memory is being freed twice, and is issuing the assertion when the Fortran RTL tries to free it. I'm not sure why the Fortran RTL didn't detect the error - you may have corrupted some other data.

If you can send us (to vf-support@compaq.com) a short example that shows the problem, we'll look into it.

Steve
0 Kudos
Intel_C_Intel
Employee
2,047 Views
It seems that, in some way, this should be caught by the STAT identifier instead of causing an execution failure of the RTL.

I am studying how to build a smaller example and/or just avoiding the double-deallocation.

Matt.
0 Kudos
Steven_L_Intel1
Employee
2,047 Views
I agree - if it can tell that the pointer has already been deallocated, it should quickly return with an error. However, if the call is made to the C RTL's "free", then if the C RTL signals an assertion, there's not much CVF can do.

Steve
0 Kudos
jorjani
Beginner
2,047 Views
Well, well ...

I received the same message as well: "Debug Assertion Failed". Please also remember that the program compiled just fine in the Debug mode. It was at the time of testing the program on data that I got this cryptic message.

The program I am using is way over my head and therefore, I did not DARE to change any one of the pointers, allocate/deallocates, ... However, I could
compile and successfully run the program in Release mode.

Now, my question is what happens if the program really needs a debugging for a different reason or part? Wouldn't I get stuck in this nuisance "Assertion Failure" and fail to debug it?

Regards ... Hossein
0 Kudos
Reply