Skip to content

Commit

Permalink
Fix #8558: do not blindly use Alias binding
Browse files Browse the repository at this point in the history
  • Loading branch information
alainfrisch committed Mar 29, 2019
1 parent 10994d8 commit 918a842
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bytecomp/simplif.ml
Expand Up @@ -282,7 +282,7 @@ let simplify_exits lam =
xs ys Ident.Map.empty
in
List.fold_right2
(fun (y, kind) l r -> Llet (Alias, kind, y, l, r))
(fun (y, kind) l r -> Llet (Strict, kind, y, l, r))
ys ls (Lambda.rename env handler)
with
| Not_found -> Lstaticraise (i,ls)
Expand Down
9 changes: 9 additions & 0 deletions testsuite/tests/basic/localfunction.ml
Expand Up @@ -21,3 +21,12 @@ let () =
Printf.printf "%i\n%!" !r;
assert(x1 -. x0 = x2 -. x1)
(* check that we did not allocated anything between x1 and x2 *)


let () =
(* #8558 *)
let f () = () in
let r = ref 0 in
let g () = f (incr r) in
g ();
assert (!r = 1)

0 comments on commit 918a842

Please sign in to comment.