Commit e399bfc
MM frontend: fix uninit-output bugs (#15662)
* Expression.addVec was unused (only Expression.subVec is called from
ResolveLoops.mo). Remove addVec; the early-\`return;\` in its body
reads back an uninitialised output array.
* Expression.subVec hit the same uninit-output bug on the size-mismatch
path. Replace \`return;\` with \`fail();\` so an error message at the
caller surfaces, matching the function's documented behaviour.
* Static.elabExp_If: rewrote the inner \`_ := matchcontinue()\` to
return its values directly via \`(outCache, outExp, outProperties)
:= matchcontinue() … then (outCache, outExp, outProperties); \`.
Returning the values explicitly makes the data flow direct and
easier to analyze.
* Static.deduceIterationRange: initialise \`outRange\` and
\`outProperties\` with neutral sentinels (\`DAE.ICONST(0)\` /
\`DAE.PROP(T_UNKNOWN_DEFAULT, C_UNKNOWN)\`) to make the analysis
easier. (It was safe before, just hard to prove)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 62ac102 commit e399bfc
2 files changed
Lines changed: 7 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4159 | 4159 | | |
4160 | 4160 | | |
4161 | 4161 | | |
4162 | | - | |
4163 | | - | |
4164 | | - | |
4165 | | - | |
4166 | | - | |
4167 | | - | |
4168 | | - | |
4169 | | - | |
4170 | | - | |
4171 | | - | |
4172 | | - | |
4173 | | - | |
4174 | | - | |
4175 | | - | |
4176 | | - | |
4177 | | - | |
4178 | | - | |
4179 | | - | |
4180 | 4162 | | |
4181 | 4163 | | |
4182 | 4164 | | |
| |||
4186 | 4168 | | |
4187 | 4169 | | |
4188 | 4170 | | |
4189 | | - | |
4190 | | - | |
| 4171 | + | |
| 4172 | + | |
4191 | 4173 | | |
4192 | 4174 | | |
4193 | 4175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | | - | |
| 482 | + | |
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
495 | | - | |
| 495 | + | |
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
508 | | - | |
| 508 | + | |
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
| |||
1486 | 1486 | | |
1487 | 1487 | | |
1488 | 1488 | | |
1489 | | - | |
1490 | | - | |
| 1489 | + | |
| 1490 | + | |
1491 | 1491 | | |
1492 | 1492 | | |
1493 | 1493 | | |
| |||
0 commit comments