https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122521
--- Comment #44 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Mikael Morin <[email protected]>: https://gcc.gnu.org/g:07a13c627948d4983cc930fa678481cca3e13198 commit r17-6979-g07a13c627948d4983cc930fa678481cca3e13198 Author: Mikael Morin <[email protected]> Date: Tue Dec 1 11:54:53 2026 +0100 fortran: array descriptor: Remove redundant array type unwrapping [PR122521] The function gfc_set_descriptor_from_scalar unwraps any pointer or reference type around an array type from the element type it passes as argument to the function gfc_get_dtype_rank_type. The latter function unwraps pointer and array types similarly from its input, making the previous unwrapping redundant. This change updates the unwrapping from gfc_get_dtype_rank_type to also remove reference types, so that the unwrapping from gfc_set_descriptor_from_scalar is truly redundant and can be removed. The test is a case triggering an ICE if the gfc_get_dtype_rank_type hunk is absent. PR fortran/122521 gcc/fortran/ChangeLog: * trans-descriptor.cc (gfc_set_descriptor_from_scalar): Pass element type to gfc_get_dtype_rank_type without redundantly unwrapping any pointer type from it. * trans-types.cc (gfc_get_dtype_rank_type): Also unwrap any REFERENCE_TYPE. gcc/testsuite/ChangeLog: * gfortran.dg/char_associated_2.f90: New test.
