Advertisement

VM stack issue

Started by January 29, 2011 03:07 AM
1 comment, last by WitchLord 14 years ago
AS:

class Good
{
vector3 _val;

Good(const vector3& in val)
{
_val = val;
}
};

class Bad
{
vector3 _val;

Bad(const vector3& val)
{
_val = val;
}
};

void test()
{
// runs fine
for (int i = 0; i < 2; i++)
Good(vector3(1, 2, 3));

// causes vm stack corruption
for (int i = 0; i < 2; i++)
Bad(vector3(1, 2, 3));
}


This is just a simple example, the problem happens if I use any of my native POD types as well... Also, I've set EP_ALLOW_UNSAFE_REFERENCES to true to avoid using in/out for every ref. The constructor should finish the copy before the reference is invalid no?


Chris
_
I'll need to investigate this. You've probably found a bug in the compiler.

What version of AngelScript are you using?

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

This topic is closed to new replies.

Advertisement