FAILURE MAP
← Case archive

FA-90249 / Bytecode virtual machines / Member archive

Numeric for loop: last iteration dropped · case 04

for i = 1, 4 yields 1, 2, 3.

Member previewVariant 4 · 3 implementations · 10 checks per implementation

Case contract

Numeric for-loop preparation (Lua-style FORPREP/FORLOOP). A zero step is an error. With integer init and step, a float limit is floored for positive steps and ceiled for negative ones; the loop is skipped when init is already past the limit in the step direction; otherwise the iteration count (limit - init) // step is precomputed (for negative steps (init - limit) // -step) and the loop runs count + 1 times. Otherwise the loop uses floats and re-tests v <= limit (v >= limit for negative steps). Return at most the first 20 control values.

Why this case matters

Loop-preparation opcodes must precompute counts exactly to avoid off-by-one and overflow bugs.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
regression: ascending integer loop[1, 2, 3, 4, 5, 6][1, 2, 3, 4, 5, 6, 7]Failed

MEMBER ARCHIVE

The complete case is available to members.

This record includes three runnable implementations, regression fixtures, execution results, and source hashes.

Member access is invitation-based. Sign in with your invited account to inspect the sources.

Sign in to the archive ↗