https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62044
--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- > The following, which works OK with another brand, selects the "wrong type" > with trunk. 4.9 still segfaults. Without the use rename, 4.9 runs and gives > the wrong result. The following test without module also selects the "wrong type" when compiled with 4.8 up to 5.0 implicit none type, abstract :: GridImageSiloTemplate end type GridImageSiloTemplate type, extends ( GridImageSiloTemplate ) :: & UnstructuredGridImageSiloForm end type UnstructuredGridImageSiloForm call foo contains subroutine foo class (GridImageSiloTemplate), allocatable :: a type (UnstructuredGridImageSiloForm) :: b allocate (a, mold = b) select type (a) type is (UnstructuredGridImageSiloForm) print *, "correct type selected" class default print *, "wrong type" end select end subroutine end