-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
Compound assignment with post increment in lhs miscompiles #2730
Labels
Comments
Appears that this generates something like (func $start:module
(local $0 i32)
(local $1 i32)
(local $2 i32)
global.get $module/arr
global.get $module/val ;; = 0
local.tee $2 ;; $2 = $val (= 0)
i32.const 1
i32.add
global.set $module/val ;; $val = $2 + 1 (= 1)
local.get $2 ;; (-> 0)
global.get $module/arr
global.get $module/val
local.tee $1 ;; $1 = $val (= 1)
i32.const 1
i32.add
global.set $module/val ;; $val = $1 + 1 (= 2)
local.get $1 ;; (-> 1)
call $~lib/staticarray/StaticArray<u32>#__get;;($arr, 1) -> $temp
i32.const 1234
i32.or
call $~lib/staticarray/StaticArray<u32>#__set;;($arr, 2, $temp | 1234)
)
) where the increment is erroneously performed two times, likely due to compiling the additional |
Changqing-JING
added a commit
to Changqing-JING/assemblyscript
that referenced
this issue
Oct 17, 2023
Changqing-JING
added a commit
to Changqing-JING/assemblyscript
that referenced
this issue
Oct 17, 2023
Changqing-JING
added a commit
to Changqing-JING/assemblyscript
that referenced
this issue
Oct 17, 2023
Changqing-JING
added a commit
to Changqing-JING/assemblyscript
that referenced
this issue
Oct 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug description
Compound assignment where the left hand side is an array with a post increment index generates incorrect code.
actually is generating something like
Steps to reproduce
Editor
Should print
1234
, instead crashesAssemblyScript version
0.27.7
The text was updated successfully, but these errors were encountered: