[Bug cobol/126541] New: cobol1: error recovery: implicit define missing data items

simonsobisch at gnu dot org via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126541

            Bug ID: 126541
           Summary: cobol1: error recovery: implicit define missing data
                    items
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: cobol
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simonsobisch at gnu dot org
  Target Milestone: ---

in case when there's a typo in the DATA DIVISION - or a missing/wrong copybook,
the same variable is error'd all over the place - and quickly fills
-fmax-errors

test.cob:658:23: error: DATA-ITEM ‘S-GEWM’ not found
  658 |               COMPUTE S-GEWM = S-GEWSALDOZSM /
      |                       ^~~~~~~~~
test.cob:661:25: error: DATA-ITEM ‘Z-S-GEWM’ not found
  661 |               MOVE 0 TO S-GEWM.
      |                         ^~~~~~~~~
test.cob:689:25: error: DATA-ITEM ‘Z-S-GEWM’ not found
  689 |               MOVE 0 TO S-GEWM.
      |                         ^~~~~~~~~
test.cob:702:17: error: DATA-ITEM ‘S-GEWM’ not found
  702 |            MOVE S-GEWM       TO DNL-GEWM.
      |                 ^~~~~~~~~
test.cob:777:25: error: DATA-ITEM ‘Z-S-GEWM’ not found
  777 |               MOVE 0 TO S-GEWM.
      |                         ^~~~~~~~~
test.cob:956:25: error: DATA-ITEM ‘Z-S-GEWM’ not found
  956 |               MOVE 0 TO S-GEWM.
      |                         ^~~~~~~~~

I suggest to internally define it, preferably per its use; which is what
GnuCOBOL does.

Example: the COMPUTE above would copy the S-GEWSALDOZSM defintion in - or
simply defines a PIC S9(18)v(12) item.
If there is a MOVE "ABCD" TO UNDEF-VAR it would be defined as PIC X(4), or
bigger...
That would be similar for other user-defined names like "OPEN fd-name".


Also note the cc1 way of "not defined"... and then suppress all follow-up
warnings on that same data-item.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.