New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutable variables read shouldn't be substituted #7683
Comments
Comment author: @gasche Given that the order of evaluation of arguments is unspecified, I have the impression that both reported behaviors (printing 1 or 2) are correct with respect to the language specification. Do you have an example where the observed behavior is actually a bug? |
Comment author: @gasche Are you replying this because there is no example that is actually a bug (I would find it surprising, and an interesting information), or because you would rather avoid doing the work of thinking of an example that is actually a bug? |
Comment author: @nojb I tried to find an example that is a bug but so far without success. |
Comment author: @mshinwell I have posted an example of a bug which I think is due to this issue on #1499. |
Original bug ID: 7683
Reporter: @chambart
Status: confirmed (set by @mshinwell on 2017-12-06T17:08:41Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.07.0+dev/beta2/rc1/rc2
Category: middle end (typedtree to clambda)
Monitored by: @nojb @gasche @alainfrisch
Bug description
In closure.ml the Uvar constructor is supposed to be pure by 'is_simple_argument', but when the variable is mutable this
can be wrong.
Steps to reproduce
This program exhibit the problem, it returns 1 in bytecode and flambda and 2 with closure.
let f () n () =
n
let g () =
let r = ref 0 in
f (incr r) !r (incr r)
let () = print_int (g ())
The text was updated successfully, but these errors were encountered: