https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67779
--- Comment #14 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- The error occurs for class arrays only. Changing class(myclass), dimension(:) :: array to type(mysortable), dimension(:) :: array in the more simplified test case results in correct behavior.