Skip to content
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

"For loop" causing infinite loops #1201

Closed
togekk1 opened this issue Mar 30, 2020 · 2 comments
Closed

"For loop" causing infinite loops #1201

togekk1 opened this issue Mar 30, 2020 · 2 comments

Comments

@togekk1
Copy link

togekk1 commented Mar 30, 2020

Hi,

I used this "for loop" in my code:
https://github.com/togekk1/simon-cheng/blob/ded2d0354d1dbaebcf3b296674946412deffa44d/src/wasm/assembly/index.ts#L61-L66

When I put it in to comments as the link above shows, the "render" function runs normally.
When I remove the comment marks from only Line 61 and Line 66, "render" function keeps being executed.
But the array "split_by_or" only has 2 items.

Can you help me look into this? Thanks!

@dcodeIO
Copy link
Member

dcodeIO commented Mar 30, 2020

I tried for a couple minutes to get the code snippet running but gave up. No idea what the inputs are supposed to be, but when I throw something random at it it explodes due to accessing arrays out of bounds, which doesn't look like a compiler issue.

Suggesting to distill this down to something more easily reproducible, removing any code that isn't strictly necessary to trigger the issue.

@togekk1
Copy link
Author

togekk1 commented Mar 30, 2020

It turned out that I used the mutable variable "j" twice in Line 40 and Line 61. After rename the latter to "k" everything works now.

Writing the same code in Javascript it showed the same result. My bad. Closing this issue now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants