Compiler assert hit in DeallocateVariable

Started by
1 comment, last by WitchLord 8 years, 2 months ago

Hi, I've been working on updating to the svn build of AS, and I'm getting an assertion failure in asCCompiler::DeallocateVariable. It triggers when I use code like this:


class A {
	A() {}
	A(A@ other) {}
};

class B {
	B(A@ a) {
		A x(a);
	}
};

Which causes asASSERT(offset == 0x7FFF) to fail.

I commented out the assert and everything seems to be working fine, so I'm assuming for now that the assert is wrong. I do have some local changes to the angelscript source, but nothing that I can see that would cause this, so I'm hoping you're able to reproduce it. svn commit used is 2292.

Advertisement

Thanks for the bug report.

I've reproduced the problem, and will need investigate the cause and fix it.

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 bug in revision 2293.

The assert was correct. The problem was in how the compiler had prepared the argument for the A constructor call. With the bytecode sequence that was produced the content of the parameter a would be cleared with the statement 'A x(a)'. In your case it didn't cause any problem since you didn't use a afterwards, but if you had you would get a null pointer exception.

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