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

Compilation error where it shouldn't with ifort version 14.0.1

FlyingHermes
New Contributor I
914 Views

Compilation error where it shouldn't with ifort version 14.0.1

Hi,
While upgrading the ifort from version 14.0.0 to version 14.0.1 a code of mine doesn't compile anymore.
I believe that the code is correct and a regression was introduced in the ifort update.
I had quite a hard time to create a minimum example since the full fortran program is very large.
I manange to obtain the minimum expample.
It is still composed of 9 modules with less than a dozen lines each.
I guess there is still room for reducing but I didn't manage without making the error disappeared.
Note that, as I reduced the fortran program to a minimum example, the ifort version 14.0.0 compiler is now also generating an error.

The compilation complains about line 83:
[bash]
$ ifort -c unjustified_compilation_error.f90
unjustified_compilation_error.f90(83): error #8485: There is no matching specific function for this type bound generic function reference.   [COMPUTE]
  Out = Species%Che(1)%Data%Level%LevEle(1)%Compute( Inp )                      !<===> This is the line the compiler complains about
--------------------------------------------^
unjustified_compilation_error.f90(83): error #8497: Illegal use of a procedure name in an expression, possibly a function call missing parenthesis.   [COMPUTE]
  Out = Species%Che(1)%Data%Level%LevEle(1)%Compute( Inp )                      !<===> This is the line the compiler complains about
--------------------------------------------^
compilation aborted for unjustified_compilation_error.f90 (code 1)
[/bash]
So, the compiler is telling me that there is no matching specific function for the "LevEle(1)%Compute" type bound generic function.
However, if one look in the Level_Electronic_Class module which defines the LevEle_Type derived-type, one can see that there is actually a matching specific function called Compute_1D.

Notice that the compilation error disappears if one of the following action is performed:
 1. In the Level_Electronic_Class module, comment line 21 which corresponds to the use statement importing the Error object, ie. the "use Error_Module ,only: Error" instruction.
 2. In the SpeChe_Class module, on line 54 use the "only" statement of the "use" instruction
 3. In the SpeChe_Class module, comment the procedure pointer component declaration on line 58.
 
 The fortran code is given below
[fortran]
Module Kind_Parameters
  implicit none
  integer ,parameter, public :: rkp = selected_real_kind(15,307)
End Module
Module Error_Module
  implicit none
  Type  ::      Error_Type
  End Type
  Type(Error_Type) ,public :: Error
End Module
Module Level_Electronic_Class
  use Kind_Parameters ,only: rkp
  implicit none
  Type ,public         :: LevEle_Type
  contains
    generic ,public    :: Compute => Compute_1D
    procedure ,private :: Compute_1D
  End Type
  contains
Function Compute_1D( This, Inp ) result(Out)
  use Error_Module ,only: Error                                                 !<===> The error disappears if this line is commented
  class(LevEle_Type)                  ,intent(in) :: This
  real(rkp) ,dimension( :, : )        ,intent(in) :: Inp
  real(rkp) ,dimension( size(Inp,2) )             :: Out
  Out = 0.0_rkp
End Function
End Module
Module Level_Data_Class
  use Level_Electronic_Class ,only: LevEle_Type
  implicit none
  Type ,public :: Level_Data_Type
    type(LevEle_Type) ,dimension(:) ,allocatable :: LevEle
  End Type
End Module
Module SpeChe_Data_Class
  use Level_Data_Class ,only: Level_Data_Type
  implicit none
  Type ,public            :: SpeChe_Data_Type
    type(Level_Data_Type) :: Level
  End Type
End Module
Module SpeChe_Interface_Module
  implicit none
  public :: Simple_Interface
  Abstract Interface
    Subroutine Simple_Interface( Data )
      use SpeChe_Data_Class ,only: SpeChe_Data_Type
      type(SpeChe_Data_Type) ,intent(in) :: Data
    End Subroutine
  End Interface
End Module
Module SpeChe_Class
  use SpeChe_Data_Class         ,only:  SpeChe_Data_Type
  use SpeChe_Interface_Module   !,only:  Simple_Interface                       !<===> This line causes the erroneous compiler output. Note that the error disappears if the "only" instruction is used
  implicit none
  Type ,public                                            :: SpeChe_Type
    type(SpeChe_Data_Type)                                :: Data
    procedure(Simple_Interface) ,pointer ,nopass ,private :: ProcedurePointer   !<===> The error disappears if this line is commented
  End Type
End Module
Module Species_Class
  use SpeChe_Class ,only: SpeChe_Type
  implicit none
  Type ,public :: Species_Type
    type(SpeChe_Type) ,dimension(:) ,allocatable :: Che
  End Type
End Module
Module TemBeq_Class
  use Kind_Parameters ,only: rkp
  implicit none
  Type  ,public :: TemBeq_Type
  contains
    generic   ,public  :: Compute => Compute_1D
    procedure ,private :: Compute_1D
  End Type
  contains
Function Compute_1D( This, Species, Inp ) result(Out)
  use Species_Class ,only: Species_Type
  class(TemBeq_Type)                      ,intent(in) :: This
  type(Species_Type)                      ,intent(in) :: Species
  real(rkp)     ,dimension( :, : )        ,intent(in) :: Inp
  real(rkp)     ,dimension( size(Inp,2) )             :: Out
  Out = Species%Che(1)%Data%Level%LevEle(1)%Compute( Inp )                      !<===> This is the line the compiler complains about
End Function
End Module
[/fortran]

That's it.
 

0 Kudos
4 Replies
FlyingHermes
New Contributor I
914 Views

Here is the fortran file

0 Kudos
Kevin_D_Intel
Employee
914 Views

Thank you for the efforts to create the reproducer. The errors noted occur with 13.x and 14.0 compilers as you noted. I'll consult w/Development and post again soon with more.

0 Kudos
Kevin_D_Intel
Employee
914 Views

I lost sight of following up with you on your issue earlier this year. At the time of your post I submitted the issue to Development (Internal tracking id: DPD200249414); however, I'm surprised by the lack of any follow-up post from me informing you of that. I do not know how that happened, I'm sorry. As it turned out this was a new defect that was fixed in the CXE 2013 SP1 Update 2 release (14.0 compiler) earlier this year. The defect was also fixed in the development branch at that time which is now the 15.0 compiler version in the latest Intel Parallel Studio XE 2015 release.

Please accept my apologies for not following up with you as I should for such a serious issue. I hope that did not prolong any major impact on your development.

Sincerely, Kevin

0 Kudos
FlyingHermes
New Contributor I
914 Views

There's no harm done!

I'm glad it has been fixed.

Thanks

0 Kudos
Reply