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

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

reubendb's picture

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:

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

And the corresponding test program: VG_Test.f90

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

If I compile these, I get:

$ 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.

These files compile without error with the latest gfortran and Cray fortran compiler.

8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Steve Lionel (Intel)'s picture

Thanks - this is a problem that our developers are already working on. The issue ID is DPD200166645.

Steve
Steve Lionel (Intel)'s picture

This will be fixed in a future version of the compiler.

Steve
reubendb's picture

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

Steve Lionel (Intel)'s picture

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.

Steve
flying_hermes's picture

Hi,

What is the status of this bug ?

It seems to be still present in ifort version 13.1.1.

Am I right ?

Thanks

Steve Lionel (Intel)'s picture

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.

Steve
flying_hermes's picture

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)

Login to leave a comment.