FAILURE MAP
← Case archive

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

INT overflow test treats -32768 as out of range · case 02

A legitimate most-negative result sets the overflow bit and faults the processor.

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 46[[4, false, false], [32767, true, false], [30002, false, false], [1, false, false], [-32768, true, false], [31525, false, false], [-6383, false, false]][[4, false, false], [32767, true, false], [30002, false, false], [1, false, false], [-32768, false, false], [31525, false, false], [-6383, false, false]]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 ↗