[PATCH] fortran: [PR125760] Fix ICE in SELECT TYPE with array-section selector of a class array
Mikael Morin
morin-mikael@orange.fr
Sun Oct 11 09:31:20 GMT 2026
Le 10/10/2026 à 21:57, Jerry DeLisle a écrit :
> See attached patch. SELECT TYPE with an array section of a CLASS array
> as the selector, e.g. select type (a => ptr(2:4)), ICEs in
> tree_operand_check. When copying _len, trans_associate_var assumes
> target_expr is a COMPONENT_REF to _data and strips it with
> TREE_OPERAND, but a section gives a bare descriptor. The patch strips
> only a COMPONENT_REF and otherwise gets the class container from the
> selector expression with gfc_get_class_from_gfc_expr.
>
> The fix is in trans_associate_var in trans-stmt.cc; the rest is the new
> test. The bug was found with the Fujitsu compiler test suite; the test
> is new.
>
> Regression tested on x86_64.
>
> OK for mainline?
>
> Regards,
>
> Jerry
>
> ---
>
> fortran: [PR125760] Fix ICE in SELECT TYPE with array-section selector of a class array
>
> In trans_associate_var, get the class container for the _len copy
> from the selector expression when target_expr is not a _data
> COMPONENT_REF.
>
> Assisted-by: Claude Opus 5.5
>
> PR fortran/125760
>
> gcc/fortran/ChangeLog:
>
> * trans-stmt.cc (trans_associate_var): Use
> gfc_get_class_from_gfc_expr when target_expr is not a
> COMPONENT_REF.
>
> gcc/testsuite/ChangeLog:
>
> * gfortran.dg/select_type_52.f90: New test.
OK.
More information about the Gcc-patches
mailing list