https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53653
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jerry DeLisle <[email protected]>: https://gcc.gnu.org/g:4edb219aef7eec695689cf8d63ab929a2bf7d7ed commit r17-6302-g4edb219aef7eec695689cf8d63ab929a2bf7d7ed Author: Jerry DeLisle <[email protected]> Date: Sun Nov 15 11:40:08 2026 -0800 fortran: [PR127541] An array constructor is not polymorphic Without a type-spec, an array constructor took the type of its first value, so a constructor of CLASS(t) values was itself CLASS(t). ALLOCATE with such a constructor as SOURCE= hit a series of ICEs, and a later value whose declared type extends t was accepted and ICEd. An array constructor has the declared type of its values as its declared and dynamic type, and the values shall have the same declared type (F2023 7.8, C7120). Give an untyped array constructor the declared type of a CLASS value, and require that type of every value. der_io_5.f90 expected errors for output of such constructors, which are valid. Assisted-by: Claude Opus 5.5 PR fortran/127541 PR fortran/53653 gcc/fortran/ChangeLog: * array.cc (check_element_type): Without a type-spec, take the declared type of a CLASS value, and require the same declared type of all values. gcc/testsuite/ChangeLog: * gfortran.dg/der_io_5.f90: Expect no errors for output of an array constructor of polymorphic values. * gfortran.dg/pr127541.f90: New test. * gfortran.dg/pr127541_2.f90: New test.
