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

Fortran: Add more diagnostics for namelist read errors.

Fortran namelist read now provides better diagnostics for errors.

This change enhances diagnostics for errors encountered during Fortran namelist reads. It introduces a new helper function and modifies data structures to store and report error messages more precisely, improving the debugging experience for users. A test case has been updated and a new one added to verify these improvements.

In Details

The libgfortran I/O library now more robustly handles errors during namelist reads. A new function, nml_error, and a status bit in st_parameter_dt are used to defer and report error messages. The gfc_unit structure now includes a buffer (nml_err_msg) to store these deferred errors, providing better error location information than before.

For Context
namelist read
A Fortran input operation that allows reading data into program variables based on a namelist specification, providing a more flexible and user-friendly way to input data compared to fixed-format read statements.
diagnostics
Informative messages generated by the compiler or runtime library to help developers identify and fix errors in their code. Better diagnostics pinpoint the exact location and nature of a problem.
libgfortran
The runtime library for the GNU Fortran compiler (gfortran). It provides essential functions for Fortran programs, including I/O operations, intrinsic procedures, and exception handling.
Filed Under: fortrandiagnosticsruntime