🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

stackSize assertion

Started by
4 comments, last by WitchLord 15 years, 9 months ago
Hey again, I'm triggering an assertion when compiling one of the scripts and I don't find what's wrong with it. The assertion is :

void asCByteCode::AddPath(asCArray<cByteInstruction *> &paths, cByteInstruction *instr, int stackSize)
{
	if( instr->marked )
	{
		// Verify the size of the stack
		asASSERT(instr->stackSize == stackSize);
And it happens at "engine->Build( module );". I only happens at one of the scripts, and the script doesn't seem to act any wrong in release. I wonder if you could help me with some guess about it.
Advertisement
Any assert failures that happens inside the library are because of bugs in the library. I need to investigate this.

Can you give me the script code that you're compiling when the assert failure occurs. I also need to know what you're registering the engine, i.e. the types and functions.

Try to eliminate as much as possible from the engine configuration and script, while still reproduzing the assert failure. That way it will be easier for me to find the bug, and also less code for you to send.

Which version of AngelScript are you using, and on what platform?

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I'm using revision 274 of angelscript, which is, iirc, 2.13.1 + a bugfix revision. The assertion happens at both win32 and linux32 (not tested at any 64bits machine, so I don't know about those).

My code (both the script and the registration) is quite huge. I'll try to reduce it as much as I can.
Good news. I've isolated the part of the script that produces the assertion. This function does trigger it:

cFlagBase @CTF_getBaseForOwner( cEntity @ent ){    for ( cFlagBase @flagBase = @fbHead; flagBase != null; @flagBase = @flagBase.next )    {        if ( @flagBase.owner == @ent )            return flagBase;    }    return null;}


While this different version of it doesn't trigger it

cFlagBase @CTF_getBaseForOwner( cEntity @ent ){    cFlagBase @ptr = @fbHead;    while ( ptr != null )    {        if ( @ptr.owner == @ent )            break;        @ptr = @ptr.next;    }    return ptr;}


In the full script the for loop style is used at many different places. All of them trigger the assertion.
I don't think you really need this, but this is a stripped down version of the class in question:

cFlagBase @fbHead = null;class cFlagBase{    cEntity @owner;    cEntity @carrier;    cFlagBase @next;    void Initialize( cEntity @owner )    {        @this.next = @fbHead;        @fbHead = @this;        @this.owner = @owner;        @this.carrier = @owner;    }    cFlagBase()    {        Initialize( null );    }    cFlagBase( cEntity @owner )    {        Initialize( owner );    }    ~cFlagBase()    {    }}


And the full script in case of any remaining doubt:

http://pastebin.com/f5daacf8a

EDIT: I'm gonna try removing the "compare pointers" global behavior I added to cEntity objects.

EDIT2: The compare behavior isn't it. The for loop still triggers the assert with the behavior removed and proper @ = @ comparisons. I modified the function examples reflecting it.

[Edited by - jal_ on September 17, 2008 4:59:56 AM]
Thanks for the info. I've reproduced the problem with no engine configuration and this script:

class cFlagBase {}void CTF_getBaseForOwner( ){  for ( cFlagBase @flagBase; ; @flagBase = null )  {  }}


The problem seems to be with the last assignment in the loop, because if I remove that part the assert failure goes away.

I'll be back with a bug fix as soon as possible.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

The bug fix is now available in the SVN (revision 297)

Thanks a lot for the bug report.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement