summaryrefslogtreecommitdiff
path: root/ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield2.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield2.ml')
-rw-r--r--ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield2.ml40
1 files changed, 40 insertions, 0 deletions
diff --git a/ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield2.ml b/ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield2.ml
new file mode 100644
index 0000000000..727691d113
--- /dev/null
+++ b/ocaml-binary-annot/testsuite/tests/tool-ocaml/t210-setfield2.ml
@@ -0,0 +1,40 @@
+open Lib;;
+type t = {
+ mutable a : int;
+ mutable b : int;
+ mutable c : int;
+};;
+
+let x = {a = 7; b = 6; c = 5} in
+x.c <- 11;
+if x.c <> 11 then raise Not_found;
+x
+;;
+
+(**
+ 0 CONSTINT 42
+ 2 PUSHACC0
+ 3 MAKEBLOCK1 0
+ 5 POP 1
+ 7 SETGLOBAL Lib
+ 9 CONSTINT 5
+ 11 PUSHCONSTINT 6
+ 13 PUSHCONSTINT 7
+ 15 MAKEBLOCK3 0
+ 17 PUSHCONSTINT 11
+ 19 PUSHACC1
+ 20 SETFIELD2
+ 21 CONSTINT 11
+ 23 PUSHACC1
+ 24 GETFIELD2
+ 25 NEQ
+ 26 BRANCHIFNOT 33
+ 28 GETGLOBAL Not_found
+ 30 MAKEBLOCK1 0
+ 32 RAISE
+ 33 ACC0
+ 34 POP 1
+ 36 ATOM0
+ 37 SETGLOBAL T210-setfield2
+ 39 STOP
+**)