The master branch has been updated by Jerry DeLisle <[email protected]>:
https://gcc.gnu.org/g:18b2b8c0b2745df0ad297753fa3fc3a8083543b8
commit r17-5067-g18b2b8c0b2745df0ad297753fa3fc3a8083543b8
Author: Jerry DeLisle <[email protected]>
Date: Thu Jun 11 17:35:00 2026 -0700
fortran: [PR125760] Fix ICE in SELECT TYPE with array-section selector of a
class array
Thankyou.
On 10/11/26 2:31 AM, Mikael Morin wrote:
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.