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

ICE assigning allocatable character to allocatable component fixed

Correctly copies allocatable character values in structure constructors to prevent compiler crashes.

This commit resolves an Integer Compiler Error (ICE) in Fortran’s structure constructors when assigning an allocatable character to an allocatable component. The fix replaces a scalar fold_convert with gfc_trans_string_copy for explicit-length allocatable character components, ensuring correct value copying. A new test case is added.

In Details

The gfc_trans_subcomponent_assign function in fortran/trans-expr.cc has been updated to use gfc_trans_string_copy when assigning an explicit-length allocatable character component within a structure constructor. This change corrects the handling of such assignments, preventing an ICE related to PR125720.

Filed Under: fortrancompiler bug