-
Notifications
You must be signed in to change notification settings - Fork 463
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
Miscompilation of assignment #7170
Comments
Thanks for reporting. |
This appears to be due to an optimisation for records with only one field, such as |
Fixes #7170 Assignment of a ref, or other record with a single mutable field, is compiled to simple variable assignment. This triggers an incorrect optimisation that moves identical assignments in the true and false branches of a conditional above if they are identical and the guard has no side effects. Added a check that if the assigments to be moved are to variable, that variable must not occur free in the guard of the conditional.
Fixes #7170 Assignment of a ref, or other record with a single mutable field, is compiled to simple variable assignment. This triggers an incorrect optimisation that moves identical assignments in the true and false branches of a conditional above if they are identical and the guard has no side effects. Added a check that if the assigments to be moved are to variable, that variable must not occur free in the guard of the conditional.
Fixes #7170 Assignment of a ref, or other record with a single mutable field, is compiled to simple variable assignment. This triggers an incorrect optimisation that moves identical assignments in the true and false branches of a conditional above if they are identical and the guard has no side effects. Added a check that if the assigments to be moved are to variable, that variable must not occur free in the guard of the conditional.
Hi, the following code
is compiled into
Note how the assignment of
j
is moved outside theif
-expression despite the move changing the evaluation of the condition of theif
-expression. The code without the surrounding{
and}
is compiled correctly.The text was updated successfully, but these errors were encountered: