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

Fix ICE for class pointer component in structure constructor

Correctly assigns CLASS pointer components in structure constructors to non-class targets, preventing compiler crashes.

This commit fixes an Integer Compiler Error (ICE) in Fortran related to structure constructors involving class pointer components. When a class pointer component is associated with a non-class target, this change ensures that the correct data, vptr, and length are set, resolving issues for both scalar and array scenarios. New test cases are included.

In Details

The gfc_trans_subcomponent_assign function in fortran/trans-expr.cc has been modified to properly handle assignments within structure constructors. Specifically, it now correctly associates a CLASS pointer component with a non-class target by setting the _data, _vptr, and _len fields as appropriate, addressing an ICE linked to PR125721.

Filed Under: fortrancompiler bug