You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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
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