Skip to content

det runtime: a zero divisor without ON SIZE ERROR throws in the port; the oracle leaves the receiver unchanged #4655

Closed

Description

@squid-protocol

Problem

A zero divisor in COMPUTE / DIVIDE without ON SIZE ERROR: the oracle (GnuCOBOL 3.1.2 -std=ibm) sets the size-error exception and leaves the receiver unchanged (cob_decimal_div makes the intermediate NaN, cob_decimal_get_field stores nothing); the det port's Cobol.divide throws ArithmeticException and the run ends.

Measured 2026-10-07 (R PIC 999V99 VALUE 12.34, Z0 = 0):

  • COMPUTE R = A / Z0 -> oracle R = 012.34, rc 0; det port: ArithmeticException.
  • DIVIDE Z0 INTO A GIVING R -> oracle R unchanged.

ARITHMETIC-OSVS (#4287) makes a zero divisor reachable from non-zero data: a divisor expression whose intermediate has fewer places than the target loses its low-order digits (A / (C ** 3) with C = 7 and dmax 5 divides by 0 on the oracle). Found by the randomized differential run of #4287.

z/OS: a decimal divide by zero without ON SIZE ERROR is a data exception / abend (0CB), so neither side is IBM; the register has no entry for it.

Proposal

Decide which behaviour the det port models (the oracle's, so proofs can see it, plus a register entry for the z/OS abend), then make Cobol.divide / the store path carry NaN as libcob does (receiver unchanged, the statement's SIZE ERROR state set).

Part of #4270.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended behavior or logic failure in the enginelegacy-modernizationCOBOL refractor, dead-code extraction, and JCL forgingpriority: mediumscope:sweepCompletes a class the burned estates already touch (siblings); blocks no program

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions