Skip to content

Parser does not check conditions #2520

@fm-117

Description

@fm-117

Describe the bug
When using a variable in condition instead of a DataCondition (Level-88), the parser does not emit any diagnostic.

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

       IDENTIFICATION DIVISION.
       PROGRAM-ID. TCOMFL06.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 var1 PIC X.
          88 cond1 VALUE 'A'.
          88 cond1 VALUE 'B'.
       PROCEDURE DIVISION.
           IF (var1) THEN
              DISPLAY "This is definitely wrong"
           END-IF
           GOBACK
           .
       END PROGRAM TCOMFL06.

Expected behavior
Diagnostic expected at line 9 signaling an invalid condition.

Technical
New check to implement in CrossChecker. List all nodes that should be checked or find another way to factorize condition checks.

How to test automatically
Standard program parsing test.

Metadata

Metadata

Assignees

Labels

BugCobolUser VisibleVisible by the end user. Useful to priorize issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions