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

Import statement failes. Compiler bug?

Robert_van_Amerongen
New Contributor III
466 Views

The following code fails (Update 1, 2016.0.1.51; both 32 bits and 64 bits.)

  MODULE ti_mod
  USE ISO_C_BINDING
  IMPLICIT none
  PRIVATE
!
  INTEGER,PUBLIC,PARAMETER :: GLintptr = C_INTPTR_T
!
  PUBLIC :: glBsd
  POINTER :: glBsd
  INTERFACE
    SUBROUTINE glBsd(tg) BIND(C)
!
!  The following two lines let the compilation fail:
!
    IMPORT :: GLintptr
    INTEGER(KIND=GLintptr),VALUE :: tg
!
!  If the preceeding lines are replace by the following ones, everything wents fine.
!
!  USE ISO_C_BINDING
!  INTEGER(KIND=C_INTPTR_T),VALUE :: tg
!
    END SUBROUTINE glBsd
  END INTERFACE
!
  END MODULE ti_mod

Our gfortran friends do not complain! A compiler bug, I guess?

0 Kudos
2 Replies
Steven_L_Intel1
Employee
466 Views

Thanks - escalated as DPD200380354. Another way around this is to use an abstract interface, which is how I like to declare procedure pointers. For example:

  MODULE ti_mod
  USE ISO_C_BINDING
  IMPLICIT none
  PRIVATE
!
  INTEGER,PUBLIC,PARAMETER :: GLintptr = C_INTPTR_T
!
  PUBLIC :: glBsd
  PROCEDURE(glBsd_Int), POINTER :: glBsd
  ABSTRACT INTERFACE
    SUBROUTINE glBsd_Int(tg) BIND(C)
    IMPORT :: GLintptr
    INTEGER(KIND=GLintptr),VALUE :: tg
    END SUBROUTINE glBsd_Int
  END INTERFACE
!
  END MODULE ti_mod

 

0 Kudos
Robert_van_Amerongen
New Contributor III
466 Views

Steve, thanks for the suggestion.

0 Kudos
Reply