https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98638
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> --- Reduced test-case: module shape_mod type rectangle end type type, extends (rectangle) :: square real, allocatable :: r(:) end type end use shape_mod logical results(8) class(rectangle),allocatable :: r class(rectangle),allocatable :: r2 allocatable rr(:) select type(o=>r) class is (square) allocate(rr,source=o%r) select type(r2) class is (square) results = or .eq. rr end select end select end