ICE from polymorphic MOVE_ALLOC

ICE from polymorphic MOVE_ALLOC

Hi,

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(:)
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

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:

Compiling with Intel(R) Visual Fortran Compiler XE 13.0.0.089 [Intel(R) 64]...
test.f90
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)

Cheers,
Ben.

3 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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.

Steve - Intel Developer Support

This error will be properly diagnosed in a future release.

Steve - Intel Developer Support

发表评论

登录添加评论。还不是成员?立即加入