https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64757
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> It it certainly related, but I'm not sure it is an exact duplicate.
> In particular the above PR has quite a history and includes several
> test cases. Let's keep it separate for now.
I disagree. AFACT this PR gives the same ICE as the test in pr49213 comment 8
or the following variant of the original code
program main
type :: S
integer :: n
end type
type(S) :: Sobj
type, extends(S) :: S2
integer :: m
end type
type(S2) :: S2obj
type :: T
class(S), allocatable :: x
end type
type(T) :: Tobj
Sobj = S(1)
Tobj = T(Sobj)
S2obj = S2(1,2)
print *, S2obj%n, S2obj%m
end program
Actually pr49213 is a collection of different bugs, one being this PR. IMO
pr49213 should be split along the different bugs.