summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2019-04-01 09:34:35 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2019-04-01 09:36:26 +0200
commitb7e3ca750a6ff025d796f860ae3fea689f4cdae2 (patch)
tree83432f8e7a49952ad31e306280dd7ff2e21216de /testsuite
parentd84c3aaa5cd763b3ba1b7950714452a9704f7880 (diff)
downloadocaml-b7e3ca750a6ff025d796f860ae3fea689f4cdae2.tar.gz
Use Strict bindings when simplifying Lstaticraise (#8559)
Alias bindings were used before, but as #8558 shows this can be incorrect, as the argument to `Lstaticraise` may be impure. Adds a regression test. Closes: #8558
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/tests/basic/localfunction.ml9
1 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/basic/localfunction.ml b/testsuite/tests/basic/localfunction.ml
index 31a757e052..6ea7b5d76a 100755
--- a/testsuite/tests/basic/localfunction.ml
+++ b/testsuite/tests/basic/localfunction.ml
@@ -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)