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

Fortran: Fix ICE-on-invalid in trans_code.

Prevents an internal compiler error in the Fortran front-end when handling invalid expressions.

This commit addresses an internal compiler error (ICE) that occurred in the Fortran front-end’s trans_code function. The error happened when the compiler attempted to set the source code location for invalid tree expressions, such as error_mark_node. By adding a check to ensure that location information is only set for valid expression nodes, this commit prevents the ICE and improves the compiler’s robustness when encountering errors during code translation.

In Details

Fixes an ICE in fortran/trans.cc's trans_code function by preventing set_location from being called on non-expression tree nodes, specifically error_mark_node. This avoids attempting to assign a location to an invalid marker, which would otherwise cause an ICE during the tree traversal for code generation.

For Context
ICE
Internal Compiler Error. A severe error detected by the compiler during its own processing, indicating a bug in the compiler itself.
Fortran
A high-level programming language commonly used for scientific and numerical computation. GCC includes a front-end for compiling Fortran code.
Tree Expression
GCC represents code internally using a tree-like data structure. Tree expressions are nodes within this structure that represent computations or values.
Filed Under: fortranicebugfix