Skip to content

Incorrect code generation for nested recursive bindings #7447

@vicuna

Description

@vicuna

Original bug ID: 7447
Reporter: @yallop
Assigned to: @chambart
Status: resolved (set by @mshinwell on 2017-03-10T16:48:39Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Fixed in version: 4.06.0 +dev/beta1/beta2/rc1
Category: back end (clambda to assembly)
Tags: patch
Related to: #7231
Monitored by: @stedolan

Bug description

This issue was originally reported by stedolan under 7231 (where there's some discussion), but it deserves its own PR, since it's a different problem. Here's stedolan's report:

This seems like a thorny issue. How does the patch handle the following?

    # let rec r = (let rec x = `A r and y = fun () -> x in y);;
    val r : unit -> [> `A of 'a ] as 'a = <fun>
    # let (`A x) = r () in x ();;
    Segmentation fault

Note that in this example, the right-hand sides of each equation are more sensible, since no value is eliminated during its definition (the suspicious 'y ()' from the original test case has been removed).

(The polymorphic variant `A is used to allow recursive types, you can also try this example using plain variants and -rectypes.) 

(ocaml/ocaml#7231#c15819)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions