ICE from polymorphic MOVE_ALLOC

ICE from polymorphic MOVE_ALLOC


I'm getting an Internal Compiler Error from the move_alloc call in this code:

module test
  implicit none
  type :: derived
  end type derived
  type(derived), allocatable :: all_derived(:)
  subroutine test_sub
    class(derived), allocatable :: temp(:)
    integer :: current_size, new_size
    current_size = size(all_derived)
    new_size = current_size + 1
    call move_alloc(from=temp, to=all_derived)
  end subroutine test_sub
end module test

Commenting out the move_alloc gets rid of the ICE. I'm pretty sure its because I'm moving the allocation from a polymorphic (class) to a normal (type) allocation, and indeed making temp non-polymorphic also gets rid of the ICE. I'm pretty sure I shouldn't be doing that sort of move (it was a typo, temp wasn't meant to be polymorphic, anyway), but the compiler should probably give a better error message than just an ICE.

I'm using version on Windows 7 x64:

Compiling with Intel(R) Visual Fortran Compiler XE [Intel(R) 64]...
C:UsersbmenadueGoogle DriveCodetesttest.f90(21): 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.
1>compilation aborted for C:UsersbmenadueGoogle DriveCodetesttest.f90 (code 1)


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

Thanks very much for the nice example. As you correctly note, this code is not legal. The standard says, for MOVE_ALLOC, that the TO argument "shall be polymorphic if FROM is polymorphic." I have escalated this to the developers as issue DPD200240586.

Retired 12/31/2016

This error will be properly diagnosed in a future release.

Retired 12/31/2016

Leave a Comment

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