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

GENERIC for Type-bound Procedure causes error #6632 When Calling Subroutine with Keyword Argument

reubendb
Beginner
1,491 Views
Hello,
It seems that there is a bug with GENERIC implementation for type-bound procedure. I am trying out the latest Intel Fortran Compiler on linux. When calling a GENERIC subroutine (with type-bound procedure) with Keyword argument, the compiler complains that I don't have an explicit interface, although the subroutine is in a module. Here is a test case.

Suppose I have the module file: VG_Mofule.f90:

[fortran]module VG_Module

  implicit none
  private

  type, public :: VGForm
    integer  :: dummy
  contains
    procedure, pass :: I_Alloc
    procedure, pass :: I_Assoc
    generic :: Init => I_Alloc, I_Assoc
  end type VGForm

contains

  subroutine I_Alloc ( VG, V, ClearOption )
    
    class ( VGForm ), intent ( inout ) :: VG
    integer, intent ( in ) :: V
    logical, intent ( in ), optional :: ClearOption
      
    print*, 'I_Alloc subroutine', V
    if ( present ( ClearOption ) ) print*, 'Is Clear?', ClearOption

  end subroutine I_Alloc


  subroutine I_Assoc ( VG, V, ClearOption )
    
    class ( VGForm ), intent ( inout ) :: VG
    real, dimension ( : ), intent ( in ), target :: V
    logical, intent ( in ), optional :: ClearOption  
      
    print*, 'I_Assoc subroutine', V
    if ( present ( ClearOption ) ) print*, 'Is Clear?', ClearOption
    
  end subroutine I_Assoc

end module VG_Module
[/fortran]

And the corresponding test program: VG_Test.f90

[fortran]program VG_Test

  use VG_Module

  implicit none

  type ( VGForm ) :: VG_1, VG_2, VG_3, VG_4

  call VG_1 % Init ( 1 )

  call VG_2 % Init ( [ 3., 4., 5.] )

  call VG_3 % Init ( 3, ClearOption = .true. ) !-- This call produces error

  call VG_4 % I_Alloc ( 4, ClearOption = .true. )
  
end program VG_Test[/fortran]

If I compile these, I get:
[bash]$ ifort -c VG_Module.f90 

$ ifort -o VG_Test VG_Test.f90 VG_Module.o 
VG_Test.f90(13): error #6632: Keyword arguments are invalid without an explicit interface.   [CLEAROPTION]
  call VG_3 % Init ( 3, ClearOption = .true. ) !-- This call produces error
------------------------^
compilation aborted for VG_Test.f90 (code 1)

$ ifort -V
Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.0 Build 20110309
Copyright (C) 1985-2011 Intel Corporation.  All rights reserved.

[/bash]
These files compile without error with the latest gfortran and Cray fortran compiler.
0 Kudos
7 Replies
Steven_L_Intel1
Employee
1,491 Views
Thanks - this is a problem that our developers are already working on. The issue ID is DPD200166645.
0 Kudos
Steven_L_Intel1
Employee
1,491 Views
This will be fixed in a future version of the compiler.
0 Kudos
reubendb
Beginner
1,491 Views
The latest release (2011.4.191) still has this isse :(. Any ETA for the fix ?

$>ifort -V
Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.0 Build 20110427

Thanks
0 Kudos
Steven_L_Intel1
Employee
1,491 Views
It will be some months out. Sorry for the inconvenience, but it was a complex fix which requires more testing than what normally goes into an update. If this is seriously impacting you, let me know and we may be able to help.
0 Kudos
FlyingHermes
New Contributor I
1,491 Views

Hi,

What is the status of this bug ?

It seems to be still present in ifort version 13.1.1.

Am I right ?

Thanks

0 Kudos
Steven_L_Intel1
Employee
1,491 Views

The bug reported in the original posting is fixed - it compiles fine with 13.1.1. You may have a source that gets the same error message for a different cause. Please provide an example that shows the problem you're seeing.

0 Kudos
FlyingHermes
New Contributor I
1,491 Views

By reducing the code that produced an erronious output, I've found that the error was indeed not related to the bug descibed in the current post.

I've created a new topic, "Bug using an array of derived-type with an polymorphic component" (http://software.intel.com/en-us/forums/topic/392803)

0 Kudos
Reply