Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007706OCamltypingpublic2018-01-11 12:002018-01-11 19:36
Assigned To 
PlatformOSOS Version
Product Version4.06.0 
Target VersionFixed in Version 
Summary0007706: Recursive value check too relaxed -- produces segfault
DescriptionThe 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
    val x : int -> int = <fun>
# x 42;;

Process ocaml-toplevel segmentation fault
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
gasche (developer)
2018-01-11 12:34

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).
gasche (developer)
2018-01-11 12:39

Tentative fix: [^]

- Issue History
Date Modified Username Field Change
2018-01-11 12:00 lpw25 New Issue
2018-01-11 12:34 gasche Note Added: 0018825
2018-01-11 12:34 gasche Status new => acknowledged
2018-01-11 12:39 gasche Note Added: 0018826

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker