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

Procedure pointer problems with IVF 11.0.072?

Magne_R_
Beginner
390 Views
Hi Steve,

I've included code (below) that will reproduce the compiler errors I believe should not be there.
Turning on the reprocessor flag error_1 will reproduce an error related to a function returning a procedure pointer.Turning on the reprocessor flag error_2 will reproduce an error related to a procedure pointer component of a type as an actual argument in a subroutine.

Would be very greatful for your comments.

Code example:

module procs

type :: fem
integer :: type
procedure ( ), nopass, pointer :: bf => null()
end type fem

type(fem), pointer :: femi => null()
type(fem), pointer :: femr => null()
type(fem), pointer :: femc => null()

contains

subroutine pi( x )
integer :: x

write(*,*) x
end subroutine pi

subroutine pr( x )
real :: x

write(*,*) x
end subroutine pr

subroutine pc( x )
character(len=*) :: x

write(*,*) x
end subroutine pc

subroutine pps(c, pproc )
character* 1, intent(in) :: c
procedure ( ), pointer, intent(out) :: pproc

select case( c )
case( "i", "I" )
pproc => pi
case( "r", "R" )
pproc => pr
case( "c", "C" )
pproc => pc
end select

end subroutine pps

#ifdef error_1
function ppf(c) result( pproc )
character* 1, intent(in) :: c

procedure ( ), pointer :: pproc

select case( c )
case( "i", "I" )
pproc => pi
case( "r", "R" )
pproc => pr
case( "c", "C" )
pproc => pc
end select

end function ppf
#endif

subroutine new( )

procedure ( ), pointer :: proc

allocate( femi, femr, femc )

femi%type = 1
#ifdef error_2
call pps( "i", femi%bf )
#else
call pps( "i", proc )
femi%bf => proc
#endif

femr%type = 2
call pps( "r", proc )
femr%bf => proc

femc%type = 3
call pps( "c", proc )
femc%bf => proc

end subroutine new

end module procs

program test
use procs

procedure ( ), pointer :: pf

call new( )
call femi%bf( 5 )
call femr%bf( 10.0 )
call femc%bf( "Hi!" )

pf => pi
call pps( "i", pf )
call pf( 5 )

pf => pr
call pps( "r", pf )
call pf( 10.0 )

pf => pc
call pps( "c", pf )
call pf( "Hi!" )

end program test
0 Kudos
4 Replies
TimP
Honored Contributor III
390 Views
As Steve is off for a few days, I will agree that you have demonstrated a problem which ought to be reported on premier.intel.com. Evidently, the implementation of this aspect of f2003 isn't complete, but the compiler should either implement it or give or give a more direct message about it.
0 Kudos
Kevin_D_Intel
Employee
390 Views

I thought maybe the first issue which causes an internal compiler error with newer compilers might already have been addressed, but your variant is not fixed by recent related fixes. I reported both of these to Development since you have done us the favor of providing a concise test case already.

I will update this thread as I learn more.

(error_1: Internal tracking id: DPD200119840)
(error_2: Internal tracking id: DPD200119887)
0 Kudos
Kevin_D_Intel
Employee
390 Views

Both of these issues are fixed in the upcoming 11.1 release (May/June). I will post again when this release is available.
0 Kudos
Kevin_D_Intel
Employee
390 Views

As Steve previously announced (here), the 11.1 Release is now available, including fixes related to this thread.
0 Kudos
Reply