What causes an assertion failure?

What causes an assertion failure?

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.

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

Steve - Intel Developer Support

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.

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

Steve - Intel Developer Support

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today