GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cobol

cobol: Accept REDEFINES as part of TYPEDEF.

The COBOL compiler now correctly associates REDEFINES clauses with TYPEDEF definitions.

This change updates the GCC COBOL compiler to correctly handle the REDEFINES clause when it appears in conjunction with a TYPEDEF. Previously, the compiler might not have associated these constructs properly, potentially leading to incorrect symbol table information. The modification ensures that REDEFINES are recognized as part of a TYPEDEF definition.

In Details

In COBOL, TYPEDEF (often implicitly through level numbers) defines a data structure, and REDEFINES allows another data structure to occupy the same memory space. This commit modifies gcc/cobol/symbols.cc's symbol_field function to correctly link a REDEFINES clause to its preceding TYPEDEF definition, ensuring accurate symbol resolution and type information.

For Context
REDEFINES
A COBOL clause that allows a data item to be described in multiple ways, occupying the same memory area. It's used to overlay different data structures.
TYPEDEF
In COBOL, this is often implicitly handled by level numbers to define a record structure. This commit refers to explicit or implicit type definitions.
Filed Under: cobolcompiler