Skip to content

v0.4.30

Choose a tag to compare

@proggeramlug proggeramlug released this 30 Mar 05:08
· 4380 commits to main since this release

Bug Fixes

  • arr[i] in for-loop inside function returned arr[0] for every i — LICM (Loop-Invariant Code Motion) incorrectly hoisted loop-counter-indexed array reads as invariant when BCE (Bounds Check Elimination) didn't fire. Two root causes:
    1. BCE Pattern 4 didn't recognize module-level const limits (e.g., const MAX_COINS = 100) because is_integer=false despite having const_value set — added const_value check
    2. collect_assigned_ids only scanned the loop body, missing the update expression (i = i + 1) where the counter is assigned — LICM then treated arr[i] as invariant and hoisted it with i=0

Tests

  • Added tests/test_array_index_loop.ts regression test for array index access in for-loops inside functions with many module-level arrays