Do not add 78-level entries to groups
COBOL compiler now correctly excludes 78-level entries from group item calculations.
The GCC COBOL compiler has been fixed to prevent 78-level entries from being incorrectly included in group item definitions. Previously, these entries could inflate the perceived size of a group or cause subsequent items within the group to be misparented. New tests verify that 78-level entries now correctly do not affect group sizes or structures.
In Details
This commit rectifies a bug in the GCC COBOL compiler's handling of 78-level entries (constants) within group items. Previously, calculate_capacity and symbol_field_parent_set in symbols.cc incorrectly processed 78-level entries, leading to inflated LENGTH OF for groups and potential misparenting of subsequent group members. The fix ensures 78-level entries are now properly excluded from group calculations, aligning with COBOL semantics and preventing these errors. New regression tests validate this behavior.
- COBOL
- A compiled, high-level programming language designed for business applications. GCC includes a compiler for COBOL.
- 78-level entry
- In COBOL, a data item defined at level 78 is a constant value. It does not occupy storage and cannot be subscripted or referred to by a group containing it.
- group item
- In COBOL, a data structure that contains other data items. It is used to organize related data together and can have a level number (e.g., 01, 05) to define its hierarchy.
- LENGTH OF
- A COBOL intrinsic function that returns the number of bytes occupied by a data item or group. This commit corrects its calculation when 78-level entries are present.