Summary

Running MinGW-produced Chicken from a MSVC-produced executable causes a stack overflow during initialization

Metadata

Attachments

Description

I am on Windows. I have a program, compiled via MSVC, that has a dependency on libchicken.dll, compiled via MinGW, both 64 bit. It successfully calls CHICKEN_run with the default toplevel, but during the loading of the modules, the program segfaults with a stack overflow error in various places, usually around the time it hits loading modules.scm.

It seems that Chicken underestimates the size of the stack when ran in this manner, causing it to run out of stack space much sooner than it anticipates, causing the segfault when it fails to resize the stack.

Attached is a set of files that can replicate the issue. Running make should produce call_from_cl.exe, which will segfault when run. The libchicken.dll it needs should be produced via the mingw-msys platform. You'll need MSVC's cl.exe and lib.exe installed to compile.

Changes and comments

[2018-04-18 17:48:23 UTC] jrobbins attached chicken-crash.tar.gz (description=#f)

[2018-04-23 15:32:31 UTC] jrobbins wrote:

I have found a solution to the issue- It seems like setjmp/longjmp are known to be buggy in MinGW64. Attached is a patch that solves these issues.

[2018-04-23 15:34:36 UTC] jrobbins attached patch.txt (description=#f)