[Vm-dev] FFI-Tests initialization problem

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sun Jan 26 21:37:47 UTC 2020


Hi all,
I defined new FFI-Tests with struct inside struct.
I wanted to check for correct alignment (this works as it should thanks to
Ronie!).

But when I reload the package into a new image, there is an initialization
order problem.
It seems that the struct FFITestSfd is created AFTER the struct
FFITestSsSfd.
But struct FFITestSsSfd depends on struct FFITestSfd (it is just struct
{short s1; struct FFITestSfd sfd2;}
Consequently, FFITestSsSfd DOES not get correctly initialized...
It simply ignore the missing FFITestSfd definition, and believes that it
has a single field (short s1) and that it is of size 2...

When we execute the FFIPluginTests testSuite, this can badly crash the
image because the FFI is allocating a ByteArray handle of size 2 for
returning the FFITestSsSfd by value, and the test function writes a struct
of size 12 into it...

We can't live long with such hanging sword above our heads and should
urgently fix it.
At least, you are warned, don't execute new FFI tests blindly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200126/671c98b0/attachment.html>


More information about the Vm-dev mailing list