-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Stack overflow during native compilation. #10072
Description
The compilation of the current HEAD of the ocaml-torch library fails during an ocamlopt invocation with a stack overflow. As reported in LaurentMazare/ocaml-torch#50, the problem stems from a generated module which is pretty large (more than 6000 lines), and can be bypassed by increasing the stack size. In addition the compilation of this module requires more than 6 GB of memory on my configuration.
This kind of behaviour is very unusual to me, so I thought it might be a performance bug, hence this report. To make it easier to reproduce, I made a standalone example, that doesn't require anything besides a working compiler. Just invoking make should reproduce the error. The stack trace strongly suggests that the culprit is the Spill.spill function which is non-terminal recursive. I observed the problem on versions 4.11.1, 4.12.0~alpha2 and trunk (0f7d0a640).
Let me know if I can be of some help!