Original bug ID: 7168 Reporter:@jhjourdan Status: closed (set by @damiendoligez on 2016-04-15T09:30:00Z) Resolution: fixed Priority: normal Severity: crash Platform: amd64 OS: Linux Version: 4.03.0+dev / +beta1 Target version: 4.03.0+dev / +beta1 Fixed in version: 4.03.0+dev / +beta1 Category: runtime system and C interface
When compiling and running the attached program in bytecode mode, I get a libc error (free(): invalid pointer).
The reason is that the interpreter stack is exceeded without being reallocated. The estimation of stack usage computed in bytegen.ml is too optimistic in some cases. The situation is even worsened by Setup_for_event, which can use up to 6 stack slots at any time.
I can see two solutions: either we implement a precise stack usage approximation, but this can be difficult to take into account all the situations, or I suggest using a large security margin when allocation the stack buffer (e.g. 1k word).