COBOL: Fix multiple problem reports related to parser and data handling
Several COBOL parsing and data handling issues are resolved, including requirements for PICTURE clauses, arithmetic INDEX operands, and numeric literal interpr…
This commit addresses five distinct problem reports concerning the COBOL compiler. It enforces the requirement for a PICTURE clause with COMP-3 data types, rejects arithmetic operations on INDEX operands, and corrects syntax errors where numeric literals were treated as floating-point instead of integers. Additionally, it improves handling of MOVE statements involving alphanumeric data and allows programs and paragraphs to share the same name, enhancing compiler robustness and adherence to the COBOL standard.
In Details
This commit resolves several issues in the GCC COBOL front-end, targeting its parser (parse.y) and symbol handling (symbols.cc, parse_ante.h, scan_ante.h, util.cc). Key fixes include enforcing PICTURE for PACKED-DECIMAL (RT 3671), rejecting arithmetic on INDEX types (RT 3674), correcting MOVE semantics for alphanumeric targets (RT 3692), ensuring numeric literals are correctly typed as integers or floats (RT 3709), and permitting duplicate program/paragraph names (RT 3719). These changes refine the compiler's adherence to COBOL syntax and semantics.
- COMP-3
- A COBOL data usage clause specifying packed decimal format, commonly used for numeric data to save storage space.
- PICTURE clause
- A clause in COBOL used to define the format and characteristics of data items, such as their type, length, and decimal places.
- INDEX
- A COBOL data item that holds a value representing a position within a table or array. It is typically used with the PERFORM and SEARCH statements.
- RT
- Abbreviation for 'Reportable Error' or 'Regression Test', often used in the context of bug tracking systems to refer to specific reported issues or tests designed to reproduce them.
- Alphanumeric
- A data type in COBOL that can contain letters, numbers, and special characters.