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

COBOL: Fix SET <named-conditional> TRUE/FALSE for strings

COBOL compiler fixes an off-by-one error in string length handling for SET <named-conditional> operations.

A bug in the GCC COBOL compiler’s handling of the SET <named-conditional> {TRUE|FALSE} statement for string types has been corrected. The issue involved an off-by-one error when calculating string lengths, which has now been fixed in both the genapi.cc and libgcobol.cc components. This ensures correct length processing for named conditionals applied to strings.

In Details

In the GCC COBOL front-end, the parser_set_conditional88 function is responsible for processing SET statements that target named conditionals (also known as 88-level items). When these conditionals are associated with string data types, an off-by-one error was occurring in the calculation and passing of string lengths. This commit corrects the logic in parser_set_conditional88 to pass the accurate length value and adjusts libgcobol.__gg__refer_from_string to accept this correct value, resolving issues related to string manipulation with named conditionals.

For Context
SET <named-conditional> TRUE/FALSE
A COBOL statement used to assign a boolean value (TRUE or FALSE) to a named conditional item (an 88-level entry in the Data Division). This affects program logic based on the truth value of the conditional.
88-level item
In COBOL, a data item that represents a condition or a specific value within a larger data structure. It is used to test for specific values and is often referred to as a 'named conditional'.
string length
The number of characters in a character string. Correct handling of string lengths is crucial for many string manipulation operations.
libgcobol
The runtime library for GNU COBOL, providing services and functions needed to execute COBOL programs compiled by GCC.
Filed Under: cobolcompiler bug