Skip to content

Recursive value check too relaxed -- produces segfault #7706

Closed

Description

@vicuna

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

Activity

  1. vicuna commented on Jan 11, 2018

    @vicuna
    Author

    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).

  2. vicuna commented on Jan 11, 2018

    @vicuna
    Author

    Comment author: @gasche

    Tentative fix: #1565

  3. vicuna commented on Apr 10, 2018

    @vicuna
    Author

    Comment author: @gasche

    Fixed in 4.07 by the above pull request.

    A followup issue was found by Leo and is tracked by #7768.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions