summaryrefslogtreecommitdiff
path: root/testsuite/tests/c-api/alloc_async.ml
blob: abbf729bd66bfb4e515ea6992973703a7ee9e4bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(* TEST
 modules = "alloc_async_stubs.c";
 reason = "alloc async changes: https://github.com/ocaml/ocaml/pull/8897";
 skip;
*)

external test : int ref -> unit = "stub"

let f () =
  let r = ref 42 in
  Gc.finalise (fun s -> r := !s) (ref 17);
  Printf.printf "OCaml, before: %d\n%!" !r;
  test r;
  Printf.printf "OCaml, after: %d\n%!" !r;
  ignore (Sys.opaque_identity (ref 100));
  Printf.printf "OCaml, after alloc: %d\n%!" !r;
  ()

let () = (f [@inlined never]) ()