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

JS temp generation with array/seq/string issues #14123

Closed
6 tasks done
metagn opened this issue Apr 26, 2020 · 0 comments · Fixed by #14158
Closed
6 tasks done

JS temp generation with array/seq/string issues #14123

metagn opened this issue Apr 26, 2020 · 0 comments · Fixed by #14158

Comments

@metagn
Copy link
Collaborator

metagn commented Apr 26, 2020

JS is failing at doing operations when modifying var Ts, because of incorrectly generated and used temp variables.

All of these use an index with a subscript first (except #14117, that accesses a field) then do the add/inc operation. They all assign to temp variables instead of a field/index, like if (null != (Temp1 = arr[i-1], Temp1)) { Temp1 += 1 } else { Temp1 = 1 } when it should be if (null != (Temp1 = i-1, Temp1)) { arr[Temp1] += 1 } else { arr[Temp1] = 1 } if anything.

From my deduction, the issue is either in maybeMakeTemp in jsgen, or the subscripts like arr[i-1] are not being recognized as var T by the compiler.

Araq pushed a commit that referenced this issue Apr 29, 2020
* many bugfixes for js

fixes #12672, fixes #14153, closes #14123, closes #11331, fixes #11783, fixes #13966, fixes #14087, fixes #14117, closes #12256.

mostly fixes the fact that it was allowed to assign to newly created temp variables. additionally attempts to get rid of null initialized seqs/strings (though they might pop up here and there); this simplifies a lot of things and makes code size smaller. even if null seqs/strings pop up here and there it's still better than all those bugs existing.

* formatting fixes

* CI fixes

* more CI fixes
EchoPouet pushed a commit to EchoPouet/Nim that referenced this issue Jun 13, 2020
* many bugfixes for js

fixes nim-lang#12672, fixes nim-lang#14153, closes nim-lang#14123, closes nim-lang#11331, fixes nim-lang#11783, fixes nim-lang#13966, fixes nim-lang#14087, fixes nim-lang#14117, closes nim-lang#12256.

mostly fixes the fact that it was allowed to assign to newly created temp variables. additionally attempts to get rid of null initialized seqs/strings (though they might pop up here and there); this simplifies a lot of things and makes code size smaller. even if null seqs/strings pop up here and there it's still better than all those bugs existing.

* formatting fixes

* CI fixes

* more CI fixes
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

Successfully merging a pull request may close this issue.

1 participant