Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing diagnostic on invalid picture/usage combination #2611

Closed
fm-117 opened this issue Jan 23, 2024 · 0 comments · Fixed by #2613
Closed

Missing diagnostic on invalid picture/usage combination #2611

fm-117 opened this issue Jan 23, 2024 · 0 comments · Fixed by #2613
Assignees
Labels
Bug Cobol User Visible Visible by the end user. Useful to priorize issue

Comments

@fm-117
Copy link
Contributor

fm-117 commented Jan 23, 2024

Describe the bug
Parser does not check every usage/picture combination to report errors where needed.

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

       IDENTIFICATION DIVISION.
       PROGRAM-ID. TCOMFL06.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 var16 PIC 9(4) INDEX.
       01 var20 PIC 9(4) POINTER.
       01 var21 PIC 9(4) POINTER-32.
       01 var22 PIC 9(8) PROCEDURE-POINTER.
       01 var23 PIC 9(4) FUNCTION-POINTER.
       PROCEDURE DIVISION.
           GOBACK
           .
       END PROGRAM TCOMFL06.

All those data declarations are forbidden by IBM compiler (despite the fact that the lengths match). However our parser does not emit any diagnostic.

Expected behavior
One diagnostic (error) per line indicating that the PICTURE is forbidden.

Technical
Similar checks are already done in CrossChecker, see

var usage = commonDataDataDefinitionCodeElement?.Usage;
if (usage != null && (usage.Value == DataUsage.FloatingPoint || usage.Value == DataUsage.LongFloatingPoint) &&
commonDataDataDefinitionCodeElement.Picture != null)
{
DiagnosticUtils.AddError(dataDefinition,
"Variable with usage COMP-1 and COMP-2 cannot have a PICTURE", commonDataDataDefinitionCodeElement);
}

How to test automatically
Standard test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Cobol User Visible Visible by the end user. Useful to priorize issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant