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

Cobol: FUNCTION CHAR-NATIONAL export and UNSTRING pointer handling fixed

Fixes Cobol's FUNCTION CHAR-NATIONAL export and UNSTRING pointer handling for invalid pointers.

This commit addresses two issues in GCC’s Cobol implementation. First, the __gg__char_national function was not exported correctly; it is now added to the export map and its result is assigned to an alphanumeric type instead of a numeric one. Second, the UNSTRING function no longer improperly modifies invalid POINTER arguments, preserving their original value while still setting the OVERFLOW flag when appropriate.

In Details

The GCC Cobol front-end had two bugs: __gg__char_national was missing from libgcobol.map, leading to runtime errors, and its return value was being incorrectly assigned to a numeric type instead of a national alphanumeric type. This commit adds the function to the export map and corrects the assignment. Additionally, the unstring_fixed routine in libgcobol incorrectly modified bad POINTER arguments to '1'; it now leaves them untouched while correctly setting the OVERFLOW flag.

For Context
Cobol
A high-level programming language primarily used in business applications. GCC includes a compiler for Cobol.
FUNCTION CHAR-NATIONAL
A Cobol intrinsic function that likely converts a character to its national representation.
UNSTRING
A Cobol statement used to parse a source string and separate it into multiple destination items, similar to a split or unpack operation.
export map
A file or data structure used by linkers and dynamic loaders to specify which symbols (functions, variables) from a library should be made available to other programs.
Filed Under: cobolbugfixruntime