You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I watched this youtube video and noticed that the bug also affects mlogjs.
If we compile the following code and compare its output to the equivalent code in a browser, we see that they diverge:
leta=1print(a+++a);printFlush();
Generated code:
set a:1:4 1
op add a:1:4 a:1:4 1
op add &t0 a:1:4 a:1:4
print &t0
printflush message1
If we run the equivalent code on the browser, the answer we get is 3, but when running the generated code the answer is 4.
One way to fix this is to make mlogjs create a "security copy" of each value that goes into an expression and remove unused copies.
The first part is trivial (look at #115 and #116) but removing the unused ones requires a rework on the compiler to perform optimizations on an intermediate representation.
The text was updated successfully, but these errors were encountered:
JeanJPNM
changed the title
[bug
[bug] Variables modified inside expressions don't behave correctly
Jun 6, 2023
I watched this youtube video and noticed that the bug also affects mlogjs.
If we compile the following code and compare its output to the equivalent code in a browser, we see that they diverge:
Generated code:
If we run the equivalent code on the browser, the answer we get is
3
, but when running the generated code the answer is4
.One way to fix this is to make mlogjs create a "security copy" of each value that goes into an expression and remove unused copies.
The first part is trivial (look at #115 and #116) but removing the unused ones requires a rework on the compiler to perform optimizations on an intermediate representation.
The text was updated successfully, but these errors were encountered: