Various bug fixes in the COBOL compiler
GCC's COBOL front-end receives several bug fixes, improving handling of level-88 conditionals, linear search, index operations, and corresponding operations.
This commit addresses multiple bugs in GCC’s COBOL compiler front-end. Fixes include correctly setting subscripted level-88 named-conditionals, rectifying linear search logic, properly handling fractional index parts during operations, resolving an ICE with ADD CORRESPONDING, and optimizing subscript calculations for corresponding operations. Exception processing has also been refined to prioritize exact matches.
In Details
This patch applies several fixes to the gcc/cobol front-end, targeting specific COBOL language constructs. Issues resolved include the handling of subscripted LEVEL88 named-conditionals in genapi.cc, a bug in the linear search statement (parser_lsearch_start) where the VARYING value was misused instead of the search index, and incorrect index adjustments (parser_set_indices, parser_adjust_indices) for fractional parts. Additionally, ADD CORRESPONDING no longer produces an ICE when no fields match, and subscript calculations for ADD, SUBTRACT, and MOVE CORRESPONDING are n…
- COBOL
- A compiled programming language designed for business applications. GCC includes a front-end to compile COBOL code.
- level-88 named-conditional
- In COBOL, a level-88 entry defines a condition-name (a symbolic name) associated with a specific value or range of values for a preceding data item. These are used for readability in conditional statements.
- linear search statement
- A statement in COBOL used to search for a specific item within a table or array.
- index
- In COBOL, an index is a data item used to specify the location of a table element. It's similar to a subscript but has specific rules regarding its manipulation.
- ADD CORRESPONDING
- A COBOL statement that moves data from corresponding fields of two records to each other. 'Corresponding' typically means fields with the same name.
- ICE
- Internal Compiler Error, a fatal error that occurs when the compiler encounters an unexpected condition during translation.
- exception processing
- In COBOL, this refers to mechanisms for handling errors or exceptional conditions, such as out-of-bounds array access (EC-BOUND-SUBSCRIPT).