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

Bindings of types local to procedures can't find module procedures

IanH
Honored Contributor II
222 Views

If you have a module procedure that is explicitly marked PUBLIC, and you try and use that procedure for a binding for a type definition that is local to another procedure, then current ifort complains that the name of the module procedure doesn't have an explicit interface.

Delete the PUBLIC statement for the procedure in the specification part of the module, and all is well...

MODULE m
  IMPLICIT NONE
  PUBLIC :: True
  PUBLIC :: False      !<<<< Delete this and things work.
  
  TYPE, PUBLIC :: TraitsType
  CONTAINS
    PROCEDURE, NOPASS :: XYZ => True
  END TYPE TraitsType
  
  TYPE, PUBLIC :: Thing
    CLASS(TraitsType), ALLOCATABLE :: traits
  END TYPE Thing
CONTAINS
  SUBROUTINE proc(arg)
    TYPE(Thing), INTENT(OUT) :: arg
    
    TYPE, EXTENDS(TraitsType) :: local_traits
    CONTAINS
      PROCEDURE, NOPASS :: XYZ => False
    END TYPE local_traits
    
    ALLOCATE(arg%traits, SOURCE=local_traits())
  END SUBROUTINE proc
  
  FUNCTION True() RESULT(b)
    LOGICAL :: b
    b = .TRUE.
  END FUNCTION True
  
  FUNCTION False() RESULT(b)
    LOGICAL :: b
    b = .FALSE.
  END FUNCTION False
END MODULE m

 

>ifort /check:all /warn:all /standard-semantics "2015-09-07 true.f90"
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0 Build 20150815
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

2015-09-07 true.f90(20): error #8182: The name is neither an abstract interface nor a procedure with an explicit interface.   [FALSE]
      PROCEDURE, NOPASS :: XYZ => False
----------------------------------^
compilation aborted for 2015-09-07 true.f90 (code 1)

The mention of abstract interface in the error message is odd, as the syntax does not permit the name of an abstract interface to be used as the procedure name in a type bound procedure statement.

 

0 Kudos
2 Replies
Kevin_D_Intel
Employee
222 Views

Thank you for the report and convenient reproducer. I reported it to Development and will keep you updated.

(Internal tracking id: DPD200375834)

(Resolution Update on 05/26/2016): This defect is fixed in the Intel® Parallel Studio XE 2016 Update 3 Release (ifort Version 16.0.3.207 Build 20160415 - PSXE 2016.3.059 / CnL 2016.3.207- Windows)

0 Kudos
Kevin_D_Intel
Employee
222 Views

I confirmed this defect is fixed in the Intel® Parallel Studio XE 2016 Update 3 release available from the Intel® Software Development Products Registration Center (IRC). Thank you for reporting this defect.

0 Kudos
Reply