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

Fix SELECT TYPE ICE with array-section selector of class array

Correctly handles array-section selectors in SELECT TYPE statements involving class arrays to prevent compiler crashes.

This commit addresses an Integer Compiler Error (ICE) in Fortran’s SELECT TYPE construct when using an array-section selector on a class array. The fix ensures that the correct class container is retrieved from the selector expression, preventing the compiler from crashing. A new test case is included to verify the fix.

In Details

The trans_associate_var function in fortran/trans-stmt.cc was failing to correctly identify the class container when the target_expr was not a COMPONENT_REF. This change updates the function to use gfc_get_class_from_gfc_expr in such cases, resolving an ICE related to PR125760.

Filed Under: fortrancompiler bug