GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
cobol

cobol: Improve the creation of run-time arrays.

Enhances compile-time creation and initialization of run-time arrays in COBOL.

This commit refactors how run-time arrays are created and initialized in the GCC COBOL front-end. It improves the process by establishing these arrays as const where appropriate and adopting current best practices for initializing them using constructors. These changes aim for cleaner and more efficient generation of array structures passed to runtime library routines.

In Details

In gcc/cobol/genapi.cc and gengen.cc, routines like array_of_long_long, gg_array_of_size_t, and gg_array_of_field_pointers have been updated to create arrays more efficiently. They now use CONSTRUCTORs and mark arrays as const when applicable, aligning with modern GENERIC practices for handling arrays passed to libraries such as libgcobol. This affects how data structures are built for runtime execution.

For Context
GENERIC
An intermediate representation (IR) in GCC that sits between the front-end parse tree and the machine-specific code generation. It represents code in a higher-level, more abstract form than the final assembly.
CONSTRUCTOR
In GCC's intermediate representation, a special construct used to represent aggregate initializers for arrays or structures, often used for static or global data.
run-time arrays
Arrays whose size and allocation are determined during program execution, as opposed to compile-time arrays whose dimensions are fixed beforehand.
libgcobol
The runtime library for the GNU COBOL compiler, providing essential functions for executing COBOL programs.
Filed Under: cobolcode-generationarraysconst-correctness