mpl icon indicating copy to clipboard operation
mpl copied to clipboard

Bug: `smith-normal-form` test failure due to `bytesRequested` larger than one block at limit check

Open shwestrick opened this issue 5 years ago • 0 comments

The smith-normal-form regression test is causing a segfault.

For example, on commit dfddbd5e4111c0df8a5a37405172cc5fd717459a:

[mpl/regression]$ ../build/bin/mpl smith-normal-form.sml
[mpl/regression]$ ./smith-normal-form
...
Segmentation fault (core dumped)

I looked into it a little bit, and found that the mutator is requesting too many bytes at a limit check:

[mpl/regression]$ ../build/bin/mpl -debug true -debug-runtime true -keep g smith-normal-form.sml
[mpl/regression]$ ./smith-normal-form
...
smith-normal-form: gc/garbage-collection.c:98: GC_collect: Assertion `bytesRequested + sizeof(struct HM_chunk) <= s->controls->blockSize' failed.

In gdb, the specific bytesRequested is 4831. The default block size is 4096.

If I instead run with @mpl block-size 8K --, then the test makes more progress, but eventually still exits with a segfault, this time requesting 11983 bytes.

In principle this should be impossible because mlton/backend/limit-check.fun is supposed to ensure that less than 4K bytes are requested at limit checks: https://github.com/MPLLang/mpl/blob/dfddbd5e4111c0df8a5a37405172cc5fd717459a/mlton/backend/limit-check.fun#L1115-L1129

Should be fun to debug 😎

shwestrick avatar Sep 08 '20 14:09 shwestrick