View Issue Details [ Jump to Notes ]  [ Issue History ] [ Print ] 
ID  Project  Category  View Status  Date Submitted  Last Update 
0007168  OCaml  runtime system and C interface  public  20160307 23:09  20160415 11:30 

Reporter  jacqueshenri.jourdan  
Assigned To   
Priority  normal  Severity  crash  Reproducibility  always 
Status  closed  Resolution  fixed  
Platform  amd64  OS  Linux  OS Version  
Product Version  4.03.0+dev / +beta1  
Target Version  4.03.0+dev / +beta1  Fixed in Version  4.03.0+dev / +beta1  

Summary  0007168: Exceeeding stack limit without growing stack buffer 
Description  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). 
Tags  No tags attached. 

Attached Files  bug.ml [^] (4,161 bytes) 20160307 23:09 [Show Content] [Hide Content]let rec f x =
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in let x = x+x in let x = x+x in let x = x+x in
let x = x+x in
let _ = f x in
()
let _ = f 1

