Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Comunicados
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussões

Another ICE with parameterized derived type

FortranFan
Colaborador honorário III
671 Visualizações

Please check this out:

module m

   implicit none

   type :: t(n)

      integer, len :: n
      real :: x(n)

   end type

   type, public :: foo
      private
      real, allocatable :: m_x(:)
      type(t(:)), allocatable :: m_t
   contains
      private
      procedure, pass(this), public :: init
   end type foo

contains

   pure subroutine init(this, x, irc)

      !.. Argument list
      class(foo), intent(inout) :: this
      real, intent(in)          :: x(:)
      integer, intent(inout)    :: irc

      !.. Local variables
      integer :: size_x

      !..
      irc = 0
      size_x = size(x)

      if (size_x > 0) then
         allocate( t(size_x) :: this%m_t, stat=irc )
         if (irc /= 0) return
         this%m_t%x = sqrt(x)
         this%m_x = x
      else
         irc = 1
      end if
      !..
      return

   end subroutine init

end module m

program p

   use m, only : foo

   !..
   implicit none

   !..
   type(foo) :: a
   integer :: erc
   
   call a%init( [ 0.0, 0.0 ], erc)
   
   stop
   
end program p

Upon compilation,

------ Build started: Project: p, Configuration: Debug|x64 ------

Compiling with Intel(R) Visual Fortran Compiler XE 15.0.2.179 [Intel(R) 64]...
p.f90
101004_2054
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 C:\..\p.f90 (code 1)

 

0 Kudos
5 Respostas
Steven_L_Intel1
Funcionário
671 Visualizações

Thanks, we'll check it out.

FortranFan
Colaborador honorário III
671 Visualizações

It's worth noting even simpler code with the same pattern experiences ICE:

module m

   implicit none

   type :: t(n)
      integer, len :: n
      real :: x(n)
   end type

   type, public :: foo
      private
      type(t(:)), allocatable :: m_t
   contains
      private
      procedure, pass(this), public :: init
   end type foo

contains

   pure subroutine init(this, size_x)

      !.. Argument list
      class(foo), intent(inout) :: this
      integer, intent(in)       :: size_x

      !.. Local variables
      integer :: istat

      !..
      istat = 0

      if (size_x > 0) then
          allocate( t(n=size_x) :: this%m_t, stat=istat )
         if (istat /= 0) return
      end if

      !..
      return

   end subroutine init

end module m

program p

   use m, only : foo

   !..
   implicit none

   !..
   type(foo) :: a
   
   call a%init( 5 )
   
   stop
   
end program p

 

Steven_L_Intel1
Funcionário
671 Visualizações

Escalated as issue DPD200366571. It's the call to init that is triggering the ICE.

Steven_L_Intel1
Funcionário
671 Visualizações

Fixed for a release later this year.

FortranFan
Colaborador honorário III
671 Visualizações

Excellent, thanks.

Responder