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

Add Werrno to warn about errno, and refine syslog priority.

New Werrno warning in GCC COBOL flags potential issues with C's errno, and syslog priorities are refined for error conditions.

GCC’s COBOL compiler now supports the -Werror option, which warns if a COBOL program uses ‘error’ as a data-item name without properly referencing the C errno variable. Additionally, the severity of syslog messages for unhandled error conditions has been refined, using LOG_ERR for fatal errors and LOG_WARNING for non-fatal ones, while unimplemented or unrecognized errors still use LOG_INFO.

In Details

This commit introduces the -Werrno warning flag to the GCC COBOL front-end, specifically designed to catch instances where a COBOL program might inadvertently shadow the C global errno variable by declaring a data item named 'error'. It also refines the logging priorities for unhandled exception conditions within the libgcobol runtime, using LOG_ERR for critical errors and LOG_WARNING for less severe ones, while maintaining LOG_INFO for unknown or unimplemented exception types. The error condition (EC) processing has also been corrected for the last statement in a program.

For Context
COBOL
A compiled, high-level programming language designed for business applications. GCC includes a compiler for COBOL.
Werrno
A compiler warning option in GCC COBOL that flags potential issues related to the C global variable errno when a COBOL program uses 'error' as a data-item name.
errno
A standard C macro that holds the error number of the last library function call that failed. It's a global variable often used for error reporting in C programs.
syslog
A standard interface for sending log messages to a system logger. In this context, it refers to how error conditions are logged by the COBOL runtime.
LOG_ERR
A syslog priority level indicating an error condition.
LOG_WARNING
A syslog priority level indicating a warning condition.
LOG_INFO
A syslog priority level for informational messages.
libgcobol
The runtime library for the GNU COBOL compiler, providing support for COBOL programs.
Filed Under: cobolcompilerwarningruntimelogging