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

Cobol: Address endian issues.

Resolves significant endianness issues in GCC's COBOL front-end and libgcobol library.

This large patch addresses pervasive endianness issues affecting GCC’s COBOL compiler and its runtime library, libgcobol. Previously, the compiler implicitly assumed little-endian architectures, causing problems with various character set encodings (like UTF-16BE) and making it difficult to support big-endian systems. The changes enable COBOL to correctly handle different endian formats for both data types (BINARY, COMP-5) and execution character sets, significantly improving cross-platform compatibility.

In Details

The COBOL front-end and libgcobol runtime have undergone extensive modifications to correctly handle endianness, which previously caused significant issues. Key areas addressed include the fixed big-endian nature of COBOL's BINARY data type versus the target-dependent COMP-5, and the independent endianness of execution character sets specified by -fexec-charset. The compiler's implicit assumption of little-endian architectures has been removed, enabling support for big-endian hosts (like IBM System Z) and various multi-byte character encodings (e.g., utf-16be) on little-endian targets…

For Context
endianness
The order in which bytes are arranged in computer memory for multi-byte data types. 'Big-endian' stores the most significant byte first, while 'little-endian' stores the least significant byte first.
COBOL
A compiled programming language designed for business applications. GCC includes a COBOL front-end.
libgcobol.so
The shared library for the GNU COBOL runtime environment, providing support for executing COBOL programs compiled by GCC.
BINARY data type
A numeric data type in COBOL where values are stored in standard binary representation. It is always treated as big-endian regardless of the host or target architecture.
COMP-5 data type
A numeric data type in COBOL that stores values in binary format, similar to BINARY, but its endianness matches the target architecture.
character set
A mapping between characters and binary codes. Examples include ASCII, EBCDIC, and Unicode encodings like UTF-8, UTF-16.
utf-16be
A specific encoding of the UTF-16 character set where bytes are ordered in big-endian format. It is used to represent Unicode characters.
Filed Under: cobolendiannesscross-platformcharacter set