FAILURE MAP
← Case archive

FA-92317 / PLC ladder logic scan cycles / Member archive

INT overflow wraps as an unsigned 16-bit value · case 02

Unclamped overflow stores a positive value above 32767 instead of the negative two's-complement result.

Member previewVariant 2 · 3 implementations · 8 checks per implementation

Case contract

16-bit INT math rung followed by a later fault-clearing rung, one op per scan; ops is a list of [a, b, ADD|SUB|MUL, clear]. A result outside -32768..32767 sets the overflow bit V for that instruction and the overflow trap; the stored result is saturated to 32767/-32768 when clamp is set or wrapped as 16-bit two's complement otherwise. V is recomputed per instruction. The later rung clears the trap when clear is true; a trap still set at end of scan halts the processor. Return [result, V, trap] per scan, then "halted" and stop if faulted.

Why this case matters

Ladder programs are executed as repeated scans; each defect here changes what a rung, timer, counter or data-table instruction reports on a particular scan, which is how commissioning and field faults are actually observed.

One recorded failure

Sample boundary fixture

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

Boundary fixtureActualExpectedOutcome
regression: scenario 4[[28376, true, false], [32568, false, false], [48284, true, false], [28549, true, true], "halted"][[28376, true, false], [32568, false, false], [-17252, true, false], [28549, true, true], "halted"]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 ↗