Advertisement

asASSERT in file: as_compiller.cpp line: 675

Started by February 11, 2013 10:25 AM
8 comments, last by WitchLord 11 years, 9 months ago

Hi smile.png

I update from svn to new version, and i have asserts on debug compilation! But last version compilated with out asserts!

If i comment code:


    // At this point there should be no variables allocated
    //asASSERT(variableAllocations.GetLength() == freeVariables.GetLength());
 

Then compilate ok, and work fine!

Can you show me the script function that is being compiled when you get the assert failure? The compiler is doing something wrong if this assert failure triggers and I must fix it.

I don't get this error in any of my tests though, so you have a very specific scenario that is not covered by my tests.

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

Advertisement

Ok, but i need some time.

i find this strange bug, problem show as we use "string" and "if"

this code compilate, and work normal
void SetTexture( string txt ){}

void startGame( string &type )
{
    //if(false) SetTexture( "");


    string set_text = "hello world"; 
    output( "1 "  );
    output( "2 " + set_text );
    output( "3 "  );
} 

output:

1
2 hello world
3

this code work not correct in release, and in debug asserted
void SetTexture( string txt ){}

void startGame( string &type )
{
    if(false) SetTexture( "");

    string set_text = "hello world"; 
    output( "1 "  );
    output( "2 " + set_text );
    output( "3 "  );
}  
in release result:

1

3

i use my string class, register as:
r=en->RegisterObjectType("string", sizeof(Str), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
r=en->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructStr), asCALL_CDECL_OBJLAST); assert( r >= 0 );
r=en->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &)", asFUNCTION(CopyConstructStr), asCALL_CDECL_OBJLAST); assert( r >= 0 );
r=en->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructStr), asCALL_CDECL_OBJLAST); assert( r >= 0 );

r=en->RegisterStringFactory("string", asFUNCTION( StrFactory ), asCALL_CDECL); assert( r >= 0 );
 

So you can see the problem, replace it:

scriptstdstring.cpp



r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT,  "void f(const string &in)",    asFUNCTION(CopyConstructString), asCALL_CDECL_OBJLAST); 
assert( r >= 0 );

to:

r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT,  "void f(const string &)",    asFUNCTION(CopyConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
 

eg. "&in" to "&" and set flag to engine asEP_ALLOW_UNSAFE_REFERENCES - true

and compilate this code


void SetTexture( string txt ){}

void startGame( string &type )
{
         if(false) SetTexture( "");
}
 

Thanks for providing the sample for reproducing the problem. I'll look into this and have it fixed as soon as possible.

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

Advertisement

I've fixed this problem in revision 1564.

Thanks,

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

Goood!smile.png

I do not want to create a new topic, a small compiler error - if use not difination enum:

file: as_compiler.cpp line: 7060

script code exemple:


enum SomeEnum{    
    en_A 
}
int GetVal( SomeEnum some ){
    return 0;
}
class B
{
    int some_val = GetVal( en_B );
}
 

I'll look into it. Thanks.

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

Fixed in revision 1566. Regards.

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