File: bug13448.ml

package info (click to toggle)
js-of-ocaml 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 37,932 kB
  • sloc: ml: 135,957; javascript: 58,364; ansic: 437; makefile: 422; sh: 12; perl: 4
file content (19 lines) | stat: -rw-r--r-- 587 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(* TEST *)

(* Regression test for #13448, see explanations in #13449.
   This minimized test was proposed by Nicolas Ojeda Bar.
*)

external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get"
let uget =
  (* This intermediate definition avoids primitive specialization in
     lambda/translprim at the call site below (so that the access
     remain at kind Pgenval in the Lambda representation), but does
     not prevent inlining during the Closure pass. *)
  unsafe_get

let () =
  let int32 = 123456l in
  let arr = [| int32 |] in
  let n = uget arr 0 in
  assert (n = int32)