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

procedure pointer assignment involved in a ICE

Hans_Peschke
Beginner
339 Views
Hi,

the following lines of code results in an internal compiler error:

[fortran]! F2003 Standard: "Pointer assignment" : 7.4.2
module ice
implicit none

type adaptresult
! beside several other components of intrinsic or derived type:
procedure(adaptor), nopass, pointer :: strategy
end type adaptresult

abstract interface
function adaptor() result(res)
import :: adaptresult
type(adaptresult) :: res
end function adaptor
end interface

contains
!recursive function adapt1() result(res)
function adapt1() result(res)
type(adaptresult) :: res

! res%strategy => adapt1 ! ==> error
res%strategy => adapt2 ! ==> ICE
end function adapt1

function adapt2() result(res)
type(adaptresult) :: res

res%strategy => adapt1
end function adapt2
end module ice

program prog
use ice
implicit none

write(*,*) 'works!'
end program prog[/fortran]

Compiler output:

[plain]$ ifort -logo
Intel Fortran Compiler Professional for applications running on IA-32, Version 11.1 Build 20100414 Package ID: l_cprof_p_11.1.072
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY
$ ifort ice.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 ice.f90 (code 3)[/plain]

If the line commented with "==> error" (this is what I iniitally wanted to do) is uncommented, the compilation results in an error:

[plain]$ ifort ice.f90
ice.f90(37): error #8191: The procedure target must be a procedure or a procedure pointer. [ADAPT1]
res%strategy => adapt1 ! ==> error
--------------------^
compilation aborted for ice.f90 (code 1)[/plain]

Im not 100% sure if this code is standard-compliant, and if not so, do you know another way doing this? Defining the function as recursive, obviously it is not recursive - just an idea, does not help. AFAIK, the Fortran 2003 Standard (R742 & C727) does not restrict the possible targets.

Many Thanks

Hans

0 Kudos
4 Replies
Hans_Peschke
Beginner
339 Views
Is nobody interested in solving this internal compiler error or did I miss something?
0 Kudos
Steven_L_Intel1
Employee
339 Views
We apologize for not responding to this earlier.

I can reproduce the ICE in version 11.1 but not in a development copy of our next major release, so I presume that the ICE has been fixed.

I agree with you that the pointer assignment should be allowed - I will ask the developers to look into that. The issue ID is DPD200157329.
0 Kudos
Hans_Peschke
Beginner
340 Views
We apologize for not responding to this earlier.

I can reproduce the ICE in version 11.1 but not in a development copy of our next major release, so I presume that the ICE has been fixed.

I agree with you that the pointer assignment should be allowed - I will ask the developers to look into that. The issue ID is DPD200157329.

Thanks, sounds good. The "next major release", is this the one scheduled for august?

0 Kudos
Steven_L_Intel1
Employee
340 Views
No - August is a maintenance update to 11.1 (planned). The next major release is later in the year (probably November.)
0 Kudos
Reply