Polymorphic array from vector subscripts (catastrophic)

Polymorphic array from vector subscripts (catastrophic)


I'd like to report a catastrophic compiler error from allocating a polymoprhic array from a vector subscripted source.

A sample program is attached. I didn't find a related report with ifort 14.0.1 in this forum, so I think this may be relevant. A workaround is of course to separate array allocation and assignment.

With best regads,


program polymorphic_array
    implicit none
    type derived_type
        integer :: non_emtpy
    end type
    integer, parameter :: N = 3
    integer, dimension(N) :: subscripts = [1,2,3]
    type(derived_type), dimension(N) :: source_arr
    class(derived_type), dimension(:), allocatable :: dynamic_arr
    ! sourced allocation from vector subscript: catastrophic error 
    allocate(dynamic_arr(N), source = source_arr(subscripts))
end program

Here the compiler message:

$ ifort polymorphic_array.f90
polymorphic_array.f90(14): 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.
compilation aborted for polymorphic_array.f90 (code 1)

PS: Here's a second, related question:

As far as I understand, polymorphic arrays must contain elements of similar dynamic type. If the elements in the array constructor (sourced allocation) are polymorphic themselves, I do not get a warning/error message (example below) with any (runtime) warning options I tried. Is there an option to warn me about this?

    type parent_type
        integer :: non_emtpy
    end type
    type, extends(parent_type) :: extended_type
    end type
    class(parent_type), allocatable :: extended, parent
    class(parent_type), dimension(:), allocatable :: dynamic_arr
    allocate(parent_type :: parent)
    allocate(extended_type :: extended)
    ! different dynamic types in array constructor
    allocate(dynamic_arr(2), source = [extended, parent])

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

Thanks - I'll pass this on to the developers. We don't have an option to check that the dynamic types are the same - I will suggest that.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today