Problems with a linked list of an abstract type (Revised)

Problems with a linked list of an abstract type (Revised)

Trying to make a linked list of an abstract type, the compiler reported
(1) Feature not implement and
(2) catastrophic error: **Internal compiler error: internal abort**.
The second error message suggested that the code be sent in, so here it is.
This used 11.1, 64-bit version on Linux.

module badCrash_module
    implicit none

    integer, parameter :: dp = selected_real_kind(14)      

    type, public :: surface_type
        character(12) :: name
        real(dp), dimension(:), allocatable :: a  
        contains
        procedure :: displaySurface
    end type surface_type
    
    type, private :: element
        class (surface_type), allocatable :: object
        type (element), pointer :: next
    end type 

    type, public :: surfaceList_type
        private
        integer :: number  ! total number of objects in the set
        type (element), pointer :: first    ! first object in the list
        type (element), pointer :: last     ! last object in the list
        type (element), pointer :: getter   ! used for the iterator
    end type 

contains

subroutine displaySurface(this)
    implicit none
    class (surface_type), intent(in) :: this
 
    write(*,10)this%name,size(this%a)
    10 format(1x,'Surface ',A,' with length of a=',I0)
end subroutine

subroutine initializeSurfaceList(set) 
    type (surfaceList_type), intent(inout) :: set

    set%number = 0
    nullify(set%first)
    nullify(set%last)
    nullify(set%getter)
end subroutine initializeSurfaceList

subroutine addToSurfaceList(set, obj) 
    implicit none
    type (surfaceList_type), intent(inout) :: set
    class (surface_type)                   :: obj

    type (element), pointer :: elem

    allocate(elem) 
    ! error #5415: Feature not yet implemented: SOURCE=polymorphic_expression
    allocate(elem%object,source=obj)   
    nullify(elem%next)

    if ( set%number > 0 ) then
        set%last%next => elem
        set%last      => elem
        set%number = set%number + 1
    else
        set%first => elem
        set%last  => elem
        set%number = 1
    end if
end subroutine addToSurfaceList

subroutine displaySurfaceList(set) 
    implicit none
    type (surfaceList_type), intent(inout) :: set

    class (surface_type), pointer :: surface

    set%getter => set%first
    do
        if(.not. associated(set%getter))exit
        ! catastrophic error: 
        ! **Internal compiler error: internal abort**  Please report this error
        surface => getNextFromSurfaceListIterator(set) 
        call surface%displaySurface()            
    end do
end subroutine displaySurfaceList

function getNextFromSurfaceListIterator(set) result (obj)
    type (surfaceList_type), intent(inout) :: set
    class (surface_type), pointer          :: obj

    obj => set%getter%object
    if(associated(set%getter%next))then
        set%getter => set%getter%next 
    else
        nullify(set%getter)
    end if
end function getNextFromSurfaceListIterator 

end module badCrash_module

badCrash.f90(54): error #5415: Feature not yet implemented: SOURCE=polymorphic_expression
allocate(elem%object,source=obj)
--------------------------------^

badCrash.f90(79): catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
surface => getNextFromSurfaceListIterator(set)
--------^
compilation aborted for badCrash.f90 (code 3)

If there are ways around these problems, I would love to hear about them.
Thanks

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.