You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recursive value check too relaxed -- produces segfault #7706
Original bug ID: 7706 Reporter:@lpw25 Assigned to:@gasche Status: resolved (set by @gasche on 2018-04-10T10:35:19Z) Resolution: fixed Priority: normal Severity: minor Version: 4.06.0 Fixed in version: 4.07.0+dev/beta2/rc1/rc2 Category: typing Related to:#7768 Monitored by:@nojb@yallop
Bug description
The new recursive value check is too relaxed in how it treats [let] when it decides if a recursive definition's size can be calculated in advance:
OCaml version 4.06.0+beta1
# let rec x =
let y = if false then (fun z -> 1) else (fun z -> x 4 + 1) in
y;;
val x : int -> int = <fun>
# x 42;;
Process ocaml-toplevel segmentation fault
The problem is that identifiers are considered to be static size; in your example, "y" is considered static-sized, so the definition is accepted. This is clearly wrong for local identifiers, but it is not clear to me why it should be correct for non-local identifiers (or for identifiers defined in the same letrec-block).
Activity
vicuna commentedon Jan 11, 2018
Comment author: @gasche
Good catch!
The problem is that identifiers are considered to be static size; in your example, "y" is considered static-sized, so the definition is accepted. This is clearly wrong for local identifiers, but it is not clear to me why it should be correct for non-local identifiers (or for identifiers defined in the same letrec-block).
vicuna commentedon Jan 11, 2018
Comment author: @gasche
Tentative fix: #1565
vicuna commentedon Apr 10, 2018
Comment author: @gasche
Fixed in 4.07 by the above pull request.
A followup issue was found by Leo and is tracked by #7768.