Exceeeding stack limit without growing stack buffer #7168
Original bug ID: 7168
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).