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

COBOL: Warn about unknown exception conditions, respecting pragmas.

GCC's COBOL compiler now warns about unrecognized exception conditions, respecting `Wno-unknown-ec` pragma.

GCC’s COBOL compiler now correctly handles unrecognized or unimplemented exception conditions (EC). It emits a warning when such an EC is encountered, and this warning can be suppressed by the Wno-unknown-ec pragma. This ensures that developers are alerted to potential issues with EC specifications while allowing them to silence the warnings if intended. The change involves modifications to diagnostic handling and error reporting functions.

In Details

The enable_exceptions and complain functions in cobol1.cc and libgcobol/common-defs.h are updated to properly handle EcUnknownW. The complain function now correctly honors the EcUnknownW diagnostic level, allowing the Wno-unknown-ec warning to suppress the diagnostic when specified. This change fixes PR cobol/126492 by ensuring that unrecognized exception conditions are only warned about when the warning is enabled.

For Context
EC
Exception Condition. In the context of COBOL, this likely refers to specific conditions or states that can be raised or handled during program execution.
pragma
A directive from the programmer to the compiler, often used to control optimization, code generation, or to suppress specific warnings.
diagnostic
A message issued by the compiler to inform the user about potential problems, errors, or informational points in the code.
COBOL
A compiled high-level programming language that is designed for business applications.
Filed Under: cobolwarning