FRIDAY, JUNE 12, 2026
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.