Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

ICE from polymorphic MOVE_ALLOC

Ben3
Beginner
479 Views

Hi,

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

[fortran]module test

  implicit none

  type :: derived
  end type derived

  type(derived), allocatable :: all_derived(:)

contains

  subroutine test_sub

    class(derived), allocatable :: temp(:)
    integer :: current_size, new_size

    current_size = size(all_derived)
    new_size = current_size + 1

    allocate(temp(new_size))
    call move_alloc(from=temp, to=all_derived)

  end subroutine test_sub

end module test[/fortran]

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 13.0.0.089 on Windows 7 x64:

[plain]Compiling with Intel(R) Visual Fortran Compiler XE 13.0.0.089 [Intel(R) 64]...
test.f90
C:\Users\bmenadue\Google Drive\Code\test\test.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:\Users\bmenadue\Google Drive\Code\test\test.f90 (code 1)[/plain]

Cheers,
Ben.

0 Kudos
2 Replies
Steven_L_Intel1
Employee
479 Views

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.

0 Kudos
Steven_L_Intel1
Employee
479 Views

This error will be properly diagnosed in a future release.

0 Kudos
Reply