Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive value check too relaxed -- produces segfault #7706

Closed
vicuna opened this Issue Jan 11, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Jan 11, 2018

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

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented 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

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jan 11, 2018

Comment author: @gasche

Tentative fix: #1565

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.