Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29305 Discussions

ICE for procedure pointer with a size-dependent argument and interface block

FlyingHermes
New Contributor I
324 Views

Hi,

I found a compiler bug affecting ifx version 2025.0.4.
The bug is triggered under the following conditions:

  • A procedure pointer has a rank-1 argument whose size is specified based on the size of another argument.
  • This procedure pointer is used by another procedure defined in an interface block.

Here is a minimal working example (MWE) that reproduces the bug.

 

Module MyModule

  implicit none

  Abstract Interface
    Pure Function ProcedureInterface( InputArray ) result(Output)
      implicit none
      integer  ,intent(in)    ::  InputArray(:)
      ! Compiles fine if the returned variable is changed to a scalar
      ! logical                 ::  Output
      logical                 ::  Output(size(InputArray))
    End Function
  End Interface

  ! Compiles fine if this interface block is commented and the procedure is
  ! declared in the 'contains' scope without the 'Module' attribute.
  Interface
    Module Subroutine MySub( Proc )
      procedure(ProcedureInterface) ,pointer  ,intent(in) ::  Proc
    End Subroutine
  End Interface

  contains

  ! Uncomment if the 'interface' block above is commented... and it compiles!
!   Subroutine MySub( Proc )
!     procedure(ProcedureInterface) ,pointer  ,intent(in) ::  Proc
!   End Subroutine

  ! This procedure specification generates an ICE.
  Module Procedure MySub
  End Procedure

  ! This procedure specification genetrates the following error:
  !   error #7257:  The characteristics of the procedure argument differ from
  !                 those specified in the separate interface body.   [PROC]
!   Module Subroutine MySub( Proc )
!     procedure(ProcedureInterface) ,pointer  ,intent(in) ::  Proc
!   End Subroutine

End Module

 

The code compiles successfully if:

  • The output (Output) of the procedure pointer is changed to a scalar, or
  • No interface block is declared for the procedure (MySub) using the procedure pointer.

The compilation fails if an interface block is used and:

  • The procedure is declared using the Module Procedure form, resulting in an Internal Compiler Error (ICE).
  • The procedure is declared using the Module Subroutine form, resulting in error #7257.

Thanks.

0 Kudos
0 Replies
Reply