Skip to content

Error in subcript checking #2040

@fm-117

Description

@fm-117

Describe the bug
There is a bug in PR #2004 (issue #400), the lower bound of a literal subscript is not the MinOccurs of the table but always 1.

To Reproduce
(Type)Cobol code that cause the bug : (if any)

       IDENTIFICATION DIVISION.
       PROGRAM-ID. TCOMFL06.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 tab1.
          05 max-val pic 99.
          05 oc1 occurs 3 to 10 depending on max-val.
             10 item PIC X.
       PROCEDURE DIVISION.
           DISPLAY item (1)
           DISPLAY item (20)
           GOBACK
           .
       END PROGRAM TCOMFL06.

The parser will report 2 errors, one on each DISPLAY which is incorrect. Only the second one is wrong.

Expected behavior
Check against the constant 1 and report an error only on the second display in the example.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions