Advertisement

Compiler implicit conversion failure

Started by April 24, 2011 02:58 AM
2 comments, last by WitchLord 13 years, 9 months ago
Hi. In release mode while compiling scripts the application crashes without any log/console output. Taking a look in debug mode gives the following stack:

msvcr90d.dll!_wassert(const wchar_t * expr=0x0080ae20, const wchar_t * filename=0x0080a1b4, unsigned int lineno=4071) Line 335 C
> Engine.exe!asCCompiler::ImplicitConversion(asSExprContext * ctx=0x0012e908, const asCDataType & to={...}, asCScriptNode * node=0x0603b830, EImplicitConv convType=asIC_IMPLICIT_CONV, bool generateCode=true, asCArray<int> * reservedVars=0x00000000, bool allowObjectConstruct=false) Line 4071 + 0x35 bytes C++
Engine.exe!asCCompiler::PrepareForAssignment(asCDataType * lvalue=0x0012e814, asSExprContext * rctx=0x0012e908, asCScriptNode * node=0x0603b830, asSExprContext * lvalueExpr=0x00000000) Line 3468 C++
Engine.exe!asCCompiler::CompileDeclaration(asCScriptNode * decl=0x0603b0b0, asCByteCode * bc=0x0012ebec) Line 1785 C++
Engine.exe!asCCompiler::CompileStatementBlock(asCScriptNode * block=0x0603a810, bool ownVariableScope=true, bool * hasReturn=0x0012ecb3, asCByteCode * bc=0x0012ec70) Line 697 C++
Engine.exe!asCCompiler::CompileStatement(asCScriptNode * statement=0x0603a810, bool * hasReturn=0x0012ecb3, asCByteCode * bc=0x0012ec70) Line 2017 + 0x16 bytes C++
Engine.exe!asCCompiler::CompileCase(asCScriptNode * node=0x0603a810, asCByteCode * bc=0x0012ee80) Line 2353 C++
Engine.exe!asCCompiler::CompileSwitchStatement(asCScriptNode * snode=0x06039f10, bool * __formal=0x0012f0a3, asCByteCode * bc=0x0012ef5c) Line 2299 C++
Engine.exe!asCCompiler::CompileStatement(asCScriptNode * statement=0x06039f10, bool * hasReturn=0x0012f0a3, asCByteCode * bc=0x0012ef5c) Line 2033 + 0x14 bytes C++
Engine.exe!asCCompiler::CompileStatementBlock(asCScriptNode * block=0x05ebed18, bool ownVariableScope=true, bool * hasReturn=0x0012f0a3, asCByteCode * bc=0x0012f060) Line 700 C++
Engine.exe!asCCompiler::CompileStatement(asCScriptNode * statement=0x05ebed18, bool * hasReturn=0x0012f0a3, asCByteCode * bc=0x0012f060) Line 2017 + 0x16 bytes C++
Engine.exe!asCCompiler::CompileIfStatement(asCScriptNode * inode=0x060394f0, bool * hasReturn=0x0012f367, asCByteCode * bc=0x0012f184) Line 2412 C++
Engine.exe!asCCompiler::CompileStatement(asCScriptNode * statement=0x060394f0, bool * hasReturn=0x0012f367, asCByteCode * bc=0x0012f184) Line 2019 + 0x14 bytes C++
Engine.exe!asCCompiler::CompileStatementBlock(asCScriptNode * block=0x05e5f130, bool ownVariableScope=false, bool * hasReturn=0x0012f367, asCByteCode * bc=0x0012f324) Line 700 C++
Engine.exe!asCCompiler::CompileFunction(asCBuilder * builder=0x05de6ee0, asCScriptCode * script=0x05d781f0, asCScriptNode * func=0x05e3b268, asCScriptFunction * outFunc=0x05eef158) Line 322 C++
Engine.exe!asCBuilder::CompileFunctions() Line 513 C++
Engine.exe!asCBuilder::Build() Line 182 C++
Engine.exe!asCModule::Build() Line 140 + 0xb bytes C++
[/quote]

And line in as_compiler.cpp where the assertion fails:


void asCCompiler::ImplicitConversion(asSExprContext *ctx, const asCDataType &to, asCScriptNode *node, EImplicitConv convType, bool generateCode, asCArray<int> *reservedVars, bool allowObjectConstruct)
{
asASSERT( ctx->type.dataType.GetTokenType() != ttUnrecognizedToken ||
ctx->type.dataType.IsNullHandle() );



I can go through the scripts one error at a time instead of batch fixing (there are many scripts) them if you need more detailed information on this, or even post the offending script function (once I find it, that is) if it would help. I see that CompileStatementBlock() is recently called so I assume it is a local declaration after a case: statement? I haven't had any luck so far, I may have to resume the search tomorrow.
Found it.



class A{}
class B : A {}

void func()
{
switch(0){
default:
B @b = cast<B>( typo.createInstance() ); //typo is obviously not an object.
if(b is null)
///...
}
Advertisement
Thanks, for the report. I'll have this fixed.

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've fixed this in revision 845.

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

This topic is closed to new replies.

Advertisement