Commit f6f8124
codegen.c: fix crash in parallel assignment optimization
The direct literal generation optimization for parallel assignment was
using the RHS count as the loop bound but only filling registers for
LHS variables. When RHS has more elements than LHS (e.g., `a,=1,2`),
this caused uninitialized register indices to be used, generating
garbage opcodes that crashed the VM.
Fix by counting LHS variables and only applying the optimization when
LHS and RHS counts match exactly.
Co-authored-by: Claude <noreply@anthropic.com>1 parent 225cdaa commit f6f8124
1 file changed
+14
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5170 | 5170 | | |
5171 | 5171 | | |
5172 | 5172 | | |
5173 | | - | |
| 5173 | + | |
5174 | 5174 | | |
5175 | 5175 | | |
| 5176 | + | |
| 5177 | + | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
5176 | 5182 | | |
5177 | | - | |
| 5183 | + | |
5178 | 5184 | | |
5179 | 5185 | | |
5180 | 5186 | | |
5181 | 5187 | | |
5182 | | - | |
| 5188 | + | |
5183 | 5189 | | |
5184 | 5190 | | |
5185 | | - | |
| 5191 | + | |
| 5192 | + | |
| 5193 | + | |
| 5194 | + | |
5186 | 5195 | | |
5187 | 5196 | | |
5188 | | - | |
| 5197 | + | |
5189 | 5198 | | |
5190 | 5199 | | |
5191 | 5200 | | |
| |||
0 commit comments