GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cobol

Cobol: Correct diagnostic for numeric literal parsing

Fixes incorrect diagnostics when COBOL numeric literals are passed as arguments.

This commit corrects a bug in the cobol compiler where a numeric literal was incorrectly expanded to a whitespace character, leading to misleading diagnostics when passed by reference. The fix ensures that numeric literals are correctly represented, resulting in accurate error messages.

In Details

The COBOL parser's parse.y incorrectly expanded a numeric literal to a space (' ') when it should have been the literal's value (e.g., '18'). This affected diagnostics for BY REFERENCE or BY CONTENT clauses. This commit fixes the expansion to correctly use the numeric literal's value.

For Context
BY REFERENCE
A parameter passing mechanism in COBOL where the address of the argument is passed to the called procedure. Changes made to the parameter within the procedure affect the original argument.
BY CONTENT
A parameter passing mechanism in COBOL where a copy of the argument is passed. Changes made to the parameter within the procedure do not affect the original argument.
Filed Under: coboldiagnosticsparsing