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

ICE with valid code

MR
Beginner
409 Views

The following code produces an ICE with ifort 15.0 Build 20150407 (on Linux Intel(R) 64)

$ ifort -c testice.f90
testice.f90(50): warning #6178: The return value of this FUNCTION has not been defined.   [RES]
 elemental function met1(f) result(res)
-----------------------------------^
testice.f90(44): warning #6178: The return value of this FUNCTION has not been defined.   [RES]
 elemental function cnt_met1(f) result(res)
---------------------------------------^
testice.f90(38): warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value.  
 elemental subroutine to_ta(y,x)
----------------------------^
testice.f90: catastrophic error: **Internal compiler error: segmentation violation signal raised** 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 testice.f90 (code 1)

module m1
 implicit none

 type, abstract :: c_base
 contains
  private
  generic, public :: method => met1
  procedure(i_met1), pass(f), deferred :: met1
 end type c_base

 type, extends(c_base) :: t_cnt
 contains
  private
  procedure, pass(f) :: met1 => cnt_met1
 end type t_cnt
 
 type, extends(c_base) :: t_a
 contains
  private
  procedure, pass(f) :: met1
 end type t_a

 abstract interface
  elemental function i_met1(f) result(res)
   import :: c_base, t_cnt
   implicit none
   class(c_base), intent(in) :: f
   type(t_cnt) :: res
  end function i_met1
 end interface
 
 interface assignment(=)
   module procedure to_ta
 end interface

contains

 elemental subroutine to_ta(y,x)
  type(t_cnt), intent(in)  :: x
  type(t_a),  intent(out) :: y

 end subroutine to_ta

 elemental function cnt_met1(f) result(res)
  class(t_cnt), intent(in) :: f
  type(t_cnt) :: res

 end function cnt_met1

 elemental function met1(f) result(res)
  class(t_a), intent(in) :: f
  type(t_cnt) :: res

 end function met1
 
end module m1

!----------------------

module m2
 use m1
 implicit none

 type :: t_g
  type(t_a), allocatable :: aa(:,:), bb(:)
 end type t_g

contains

 subroutine s()

  integer :: i
  type(t_g) :: a

  allocate( a%aa(1,3), a%bb(3) )

  a%aa(1,:) = a%bb%method() ! ICE

  do i=1,3
    a%aa(1,i) = a%bb(i)%method() ! works
  enddo

 end subroutine s

end module m2

 

0 Kudos
5 Replies
Steven_L_Intel1
Employee
409 Views

Thanks - I can reproduce this and will escalate it to the developers. Even if the code was not valid, an internal compiler error is never appropriate. Issue ID is DPD200374956.

0 Kudos
MR
Beginner
409 Views

Steve, thank you.

Just to check my complete case from which this test was derived, why do you say that the code is not valid?

0 Kudos
Steven_L_Intel1
Employee
409 Views

I didn't say the code is not valid.  What I was trying to get across was that an ICE is never an acceptable response, no matter whether the code is valid or not.

As far as I can tell, your code is fine.

0 Kudos
MR
Beginner
409 Views

Ah, thank you for clarifying, then I misunderstood your comment.

As for the ICE, yes, I understand that it should be always reported, both for valid and invalid code.

Marco

0 Kudos
Steven_L_Intel1
Employee
409 Views

I expect this problem to be fixed in Update 2, scheduled for February.

0 Kudos
Reply