Sign in to follow this  

Compiler assert hit in DeallocateVariable

This topic is 664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

This topic is 664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this