Title: Compound assignment with post increment in lhs miscompiles · Issue #2730 · AssemblyScript/assemblyscript · GitHub
Open Graph Title: Compound assignment with post increment in lhs miscompiles · Issue #2730 · AssemblyScript/assemblyscript
X Title: Compound assignment with post increment in lhs miscompiles · Issue #2730 · AssemblyScript/assemblyscript
Description: Bug description Compound assignment where the left hand side is an array with a post increment index generates incorrect code. let a = new Uint32Array(1); let v = 0; a[v++] |= 1234; actually is generating something like let a = new Uint3...
Open Graph Description: Bug description Compound assignment where the left hand side is an array with a post increment index generates incorrect code. let a = new Uint32Array(1); let v = 0; a[v++] |= 1234; actually is gen...
X Description: Bug description Compound assignment where the left hand side is an array with a post increment index generates incorrect code. let a = new Uint32Array(1); let v = 0; a[v++] |= 1234; actually is gen...
Opengraph URL: https://github.com/AssemblyScript/assemblyscript/issues/2730
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Compound assignment with post increment in lhs miscompiles","articleBody":"### Bug description\n\nCompound assignment where the left hand side is an array with a post increment index generates incorrect code.\r\n\r\n```ts\r\nlet a = new Uint32Array(1);\r\nlet v = 0;\r\na[v++] |= 1234;\r\n```\r\nactually is generating something like\r\n```ts\r\nlet a = new Uint32Array(1);\r\nlet v = 0;\r\nlet v$0 = v;\r\nv += 1;\r\na[v$0] = a[v] | 1234;\r\n```\n\n### Steps to reproduce\n\n[Editor](https://www.assemblyscript.org/editor#IyFvcHRpbWl6ZT1zaXplJnJ1bnRpbWU9aW5jcmVtZW50YWwmbm9Bc3NlcnQmZGVidWcKZGVjbGFyZSBmdW5jdGlvbiBsb2coeDogdTMyKTogdm9pZApsZXQgYSA9IG5ldyBVaW50MzJBcnJheSgxKTsKbGV0IHYgPSAwOwphW3YrK10gfD0gMTIzNDsKbG9nKGFbMF0pOwojIWh0bWwKPHNjcmlwdCB0eXBlPSJtb2R1bGUiPgpjb25zdCBvdXRwdXQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnb3V0cHV0JykKY29uc3QgZXhwb3J0cyA9IGF3YWl0IGluc3RhbnRpYXRlKGF3YWl0IGNvbXBpbGUoKSwgewogIG1vZHVsZTogewogICAgbG9nKGMpIHsKICAgICAgY29uc29sZS5sb2coYyk7CiAgICB9LAogIH0sCn0pCjwvc2NyaXB0Pg==)\r\n\r\nShould print `1234`, instead crashes\n\n### AssemblyScript version\n\n0.27.7","author":{"url":"https://github.com/abextm","@type":"Person","name":"abextm"},"datePublished":"2023-08-01T10:07:41Z","url":"https://github.com/AssemblyScript/assemblyscript/issues/2730"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ccf7d2d6-a40d-eeb5-e38f-fe518fae73ad |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9CD0:3E987B:D49C57:11DAF81:6B005642 |
| html-safe-nonce | 2278814dfe6a00853a9ee61e29ab7937b85f2a8b8045e4e22d58dfa519014f02 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0QwOjNFOTg3QjpENDlDNTc6MTFEQUY4MTo2QjAwNTY0MiIsInZpc2l0b3JfaWQiOiI3OTk0MzAwMzQxOTU1MDI2NTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a0f2c02e6a0f02177542f5ea875050073721c4cef6686856b89d95b050ac9cd1 |
| hovercard-subject-tag | issue:1830918994 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/AssemblyScript/assemblyscript/2730/issue_layout |
| twitter:image | https://opengraph.githubassets.com/282e43de044bb9337d12236f3dc6737234a9b964aae8c1807a12724907ef8c3e/AssemblyScript/assemblyscript/issues/2730 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/282e43de044bb9337d12236f3dc6737234a9b964aae8c1807a12724907ef8c3e/AssemblyScript/assemblyscript/issues/2730 |
| og:image:alt | Bug description Compound assignment where the left hand side is an array with a post increment index generates incorrect code. let a = new Uint32Array(1); let v = 0; a[v++] |= 1234; actually is gen... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abextm |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| turbo-cache-control | no-preview |
| go-import | github.com/AssemblyScript/assemblyscript git https://github.com/AssemblyScript/assemblyscript.git |
| octolytics-dimension-user_id | 28916798 |
| octolytics-dimension-user_login | AssemblyScript |
| octolytics-dimension-repository_id | 105138356 |
| octolytics-dimension-repository_nwo | AssemblyScript/assemblyscript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 105138356 |
| octolytics-dimension-repository_network_root_nwo | AssemblyScript/assemblyscript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width