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

cobol: Multiple fixes including file I/O, directives, and command-line options

Several issues in GCC's COBOL compiler are fixed, including file I/O behavior, directive support, and option processing.

This commit introduces several miscellaneous fixes to the GCC COBOL compiler. It updates error message handling for Werrno, removes vertical positioning from SEQUENTIAL files while enhancing I/O plugin support for it, and reintroduces support for the #line directive. Additionally, it adds support for the GnuCOBOL DEFLIT directive and corrects a bug where the -ffree-from command-line option was ineffective. Changes also touch whitespace and internal data structures for file handling.

In Details

This commit addresses multiple issues in the COBOL frontend and libgcobol. Key changes include: using ParErrno for Werrno in cobol1.cc, correcting SEQUENTIAL file I/O in lexio.cc to ignore ADVANCING and removing vertical positioning, adding #line directive support, introducing GnuCOBOL's DEFLIT directive in scan.l, and fixing the ineffective -ffree-from option in cobol1.cc. Whitespace cleanup and updates to struct bytespan_t and struct filespan_t are also included. The I/O plugin facility in libgcobol is updated to support vertical positioning at runtime.

For Context
SEQUENTIAL file
A type of file organization in COBOL where records are stored and accessed in a sequential order. Data is read or written one record after another.
ADVANCING
A clause in COBOL I/O statements that controls whether the file position moves to the next line after a WRITE operation. For sequential files, its behavior can be constrained.
I/O plugin facility
An extension mechanism that allows custom input/output handling logic to be plugged into the compiler or runtime library, enabling support for specific file formats or system interactions.
#line directive
A preprocessor directive, often used in C/C++, that informs the compiler about the current line number and file name. This is useful for generating accurate error messages and debug information.
DEFLIT directive
A directive specific to GnuCOBOL that likely relates to defining literal values or code segments, similar to preprocessor macros.
-ffree-from
A command-line option for the COBOL compiler that likely controls the parsing of source code written in free format.
Werrno
An error condition or variable related to COBOL's file I/O operations, possibly indicating a warning or specific error state.
Filed Under: cobolcompiler-bugfile-iodirectives