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

COBOL: Correct tests for uninitialized access and RETURN-CODE

Fixes COBOL tests to properly handle uninitialized variables and RETURN-CODE initialization.

Several test cases for the GCC COBOL compiler have been corrected to improve their accuracy and robustness. These fixes include ensuring that input parameters are not written to in a way that would corrupt data (e.g., by NUL-terminating filenames) and guaranteeing that the RETURN-CODE is explicitly set to zero before returning from a program. Additionally, COBOL tests are now also run using the gcobc script to verify compatibility.

In Details

This commit addresses test inaccuracies in the COBOL frontend. It corrects tests that modified input parameters and ensures that RETURN-CODE is properly initialized in several programs. MF-specific tests are also now validated by gcobc to ensure ABI compatibility.

For Context
RETURN-CODE
A special COBOL variable that typically holds the exit status of a program. It is often set to zero to indicate successful completion.
NUL-terminate
In C-style strings, appending a null character (\0) to mark the end of the string. This is a common convention for string handling in C and related languages.
gcobc
A script or tool used in the GCC COBOL compiler test suite to run COBOL programs and check their output and behavior, ensuring compatibility with mainframe (MF) standards.
input parameter
A variable passed into a procedure or function that the procedure is not expected to modify.
Filed Under: cobolcompilertestingbugfix