https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119682
Bug ID: 119682
Summary: reference-modification (temporary literal?) yields
wrong result
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: cobol
Assignee: unassigned at gcc dot gnu.org
Reporter: simonsobisch at gnu dot org
Target Milestone: ---
I'd consider that a much worse than any SIGSEGV that may arise - as that is
"basic COBOL". It is even more shocking that this was not found before, even
with full UAT and "what ever part of NIST".
Program to reproduce the issue:
IDENTIFICATION DIVISION.
PROGRAM-ID. bug.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 N-D1 PIC 9(04).
PROCEDURE DIVISION.
MOVE '12' TO N-D1(2:2)
IF N-D1(2:2) > '12'
DISPLAY ' INVALID COMPARE ' N-D1(2:2) '!'.
GOBACK.
Note: works as expected when the data-definition is changed to 9(03).