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

ICE on procedure pointer

Arjen_Markus
Honored Contributor II
752 Views
Hello,

the program below gives an internal compiler error when compiled with Ifort 11.1 on Windows (build: 20091130). I know it contains a syntax error, but the error message is not clear ;). If I leave out the
"pointer" attribute on zf, a different message is generated which is not very clear either - it claims the name
zf is already used as an external procedure name.

If I correct the syntax error (...%zfunc => zf) it compiles correctly.

Regards,

Arjen

------

! mechanism.f90 --

! Module for registering the implementations of failure mechanisms

!

module mechanism_data

implicit none

type mechanism

character(len=40) :: name ! Name of the mechanism

character(len=40), dimension(:), pointer :: param ! Names of the relevant parameters

procedure(zfunc_evaluation), pointer, nopass :: zfunc ! Pointer to the zfunc subroutine

end type

abstract interface

subroutine zfunc_evaluation( param_value, zvalue )

real, dimension(:), intent(in) :: param_value

real, intent(in) :: zvalue

end subroutine

end interface

end module mechanism_data

module mechanism_general

use mechanism_data

implicit none

type(mechanism), dimension(100) :: registered_mechanism ! Array of mechanisms

integer :: no_registered = 0 ! Number registered

contains

subroutine register_mechanism( name, param, zf )

character(len=*), intent(in) :: name

character(len=*), dimension(:), intent(in) :: param

procedure(), pointer :: zf

integer :: i

if ( no_registered < size(registered_mechanism) ) then

i = no_registered + 1

registered_mechanism(i)%name = name

allocate( registered_mechanism(i)%param(size(param)) )

registered_mechanism(i)%param = param

registered_mechanism(i)%zfunc = zf

else

write(*,*) 'Too many mechanisms! Program stopped'

endif

end subroutine register_mechanism

end module mechanism_general

0 Kudos
2 Replies
mecej4
Honored Contributor III
752 Views
The current release for Windows is 11.1.065 (20 April 2010). The ICE that you report may have been fixed in the current release for Windows.

If the compiler experienced an internal error, the implication of the terminal statement that it made could not be more clear: "I am so thoroughly confused that I have to stop!".

With your code, the current release (11.1.072) of the Linux version of the compiler gives the error message
[bash] Intel Fortran 11.1-2739
markus.f90(34): error #8321: An EXTERNAL procedure name must not appear as the right side expression in an assignment statement. [ZF]
[/bash]
After making the modification of leaving out the pointer attribute for zf, the additional error message is
[bash]The POINTER attribute must be specified for a procedure component definition.
procedure(zfunc_evaluation), nopass :: zfunc ! Pointer to the zfunc subroutine
^[/bash]
The messages appear to be worded reasonably.

You may find this recent thread on the Linux/Mac Fortran forum to be of some relevance:

http://software.intel.com/en-us/forums/showthread.php?t=76793&o=d&s=lr

0 Kudos
Arjen_Markus
Honored Contributor II
752 Views
Indeed, those messages are understandable. I will have to verify with my sysadmins if they have the latest
version for me ;).

Regards,

Arjen
0 Kudos
Reply