Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
order of evaluation vs the ! operator #7346
Original bug ID: 7346
With ocamlopt, the order of evaluation of function arguments depends on the code generated for the argument after inlining.
With ocamlc and ocamlopt+flambda, the order is always the same.
Steps to reproduce
Try this with ocamlc and ocamlopt:
let get r = !r [@@inline never]
let i = ref 0
let f (x, y) = Printf.printf "%d %d\n" x y [@@inline never]
let g x y = Printf.printf "%d %d\n" x y [@@inline never]