(* TEST
*)

let rec f x =
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in  let x = x+x in  let x = x+x in  let x = x+x in
  let x = x+x in
  let _ = f x in
  ()

let _ =
  if (Gc.get ()).Gc.stack_limit = 0 then begin
    (* We are in native code. Skip the test because some platforms cannot
       reliably detect stack overflow. *)
    Printf.printf "OK\n"
  end else begin
    try f 1
    with Stack_overflow -> Printf.printf "OK\n"
  end
