Skip to content

det runtime: a result overflowing a binary receiver's bytes (no ON SIZE ERROR) is stored unlike GnuCOBOL #4684

Closed

Description

@squid-protocol

An arithmetic result too large for a binary receiver's bytes, with no ON SIZE ERROR, is stored differently by the det runtime and by GnuCOBOL 3.1.2 (-std=ibm, the oracle):

       01 Q8 PIC V9(4) COMP.
       01 D0 PIC 9(3) VALUE 7.
       01 P0 PIC S9(7) COMP-3 VALUE 98765.
       01 E8 PIC -9.9(5).
           MOVE 1 TO Q8
           SUBTRACT 3 D0 P0 FROM Q8
           MOVE Q8 TO E8
           DISPLAY E8

cobc: 1.24800, det port: 4.69440 (the unsigned 2-byte receiver gets -98775 at scale 4). The same happens for a left-P binary receiver (PIC VP9(4) COMP: cobc 0.59264, det 0.10688). Not P-specific: found by the P-scaled fuzz of #4669 / #4670 as the one remaining difference, reproduced with the unscaled PICTURE. Possibly the same family as the size-error / store guards of #4655. Acceptance: modelled as cobc stores it (and as IBM would, or declared), or refused by name; a test pins it.

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