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

Intel Fortran fails to detect and report an interface mismatch in a procedure pointer component

FortranFan
Honored Contributor II
343 Views

Intel Fortran fails to detect and report an interface mismatch in a procedure pointer component with PASS attribute in a structure constructor.  Here is a simple reproducer:

module m
   type :: b_t
      procedure(Isub), pointer :: psub
   end type
   abstract interface
      subroutine Isub( a )
         import :: b_t
         class(b_t), intent(in) :: a
      end subroutine
   end interface
   type, extends(b_t) :: e_t
   end type
contains
   subroutine sub( a )
      class(e_t), intent(in) :: a
   end subroutine
   subroutine s()
      type(e_t) :: e
      !e%psub => sub !<--  A
      e = e_t( sub ) !<--  B
   end subroutine 
end module 
C:\temp>ifx /c /standard-semantics p.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2022.3.0 Build 20221201
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.


C:\temp>

Uncomment the line marked as A and the compiler identifies the mismatch:

C:\temp>ifx /c /standard-semantics p.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2022.3.0 Build 20221201
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.

p.f90(19): error #8178: The procedure pointer and the procedure target must have matching arguments.
      e%psub => sub !<--  A
------^
compilation aborted for p.f90 (code 1)

C:\temp>

 

In this thread@Ron_Green writes, "Gfortran 12.0.1, a superb Fortran compiler, also catches this Standard violation."  The same applies here.

0 Kudos
1 Reply
FortranFan
Honored Contributor II
342 Views

Intel team,

FYI I have already filed a support request at Intel OSC, so technically there should be no need for one of you to open up a compiler bug ID , I presume.  I posted this thread just as a FYI for readers motivated by the comment by @Ron_Green in the other thread.

Reply