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

Error #7977: The type of the function reference does not match the type of the function

Michael_D_11
Beginner
3,782 Views

I recently updated to Intel Visual Fortran Composer XE 2011 and am running update 3 (w_fcompxe_2011.3.175). With the new compliler I started encountering Error 7977 when using functions that returned values of a user-defined type. The function in question, along with the related data type definition, were defined in a separate module which was accessed by way of the USE command in the main program.

Below is a sample code I was able to create the has the same problem I was encounting in my actual code. The sample consists of a main module with the program and a primary subroutine, a module with the type definition and the function which returns an answer of this type, and a secondary external sub-program.
 

[bash]      program main
c
      implicit none
      real :: a,b,c,d
c
      a= 10.
      b= 2.
      call test(a,b,c,d)
c
      end program main
c
      subroutine test(a,b,c,d)
      
      use props
      implicit none
c
      real :: a,b,c,d
      type (test_type) :: e
c
      call test_one()
c
      e= f_test(a,b)
         c= e%x
         d= e%y
      write(6,*)e%x,e%y
c
      return
      end subroutine test[/bash]

 

[bash]      module props
c
      implicit none
      public
c
      type :: test_type
         real :: x
         real :: y
      end type test_type
c
      contains
c
      function f_test(a,b) result(c)
c
      implicit none
c
      real, intent(in) :: a
      real, intent(in) :: b
      type (test_type) :: c
c
      c%x= a**2
      c%y= a/(abs(b)+1.)
c
      end function f_test
c
      end module props[/bash]

 

 

[bash]      subroutine test_one()
      
      implicit none
      
      real a,b,c
      
      a= 2.5
      b= 3.5
      c= a+b
      
      return
      end subroutine test_one[/bash]


The actual error given when the above is compiled is:

error #7977: The type of the function reference does not match the type of the function definition. [F_TEST]

Of interest, if the call to subroutine test_one is removed from subroutine test, no error is generated. The files above were compiled after doing a full clean of any lingering files from previous builds.

 

 

 

 

0 Kudos
1 Solution
Steven_L_Intel1
Employee
3,782 Views
Yes, this is a bug in Update 3 only. It is fixed in Update 4 (and was not in Update 2). I expect Update 4 to be available late this week. We apologize for the inconvenience. Turning off "Check routine interfaces" is a workaround.

View solution in original post

0 Kudos
8 Replies
Steven_L_Intel1
Employee
3,782 Views
This sounds like a bug in Update 3 that is fixed in Update 4. I will check this in the morning.

Does setting the project property Fortran > Diagnostics > Check Routine Interfaces to "No" make the error go away?
0 Kudos
mecej4
Honored Contributor III
3,782 Views
With Update 2 (the one prior to yours) one can compile and run the test program with no errors.
0 Kudos
Steven_L_Intel1
Employee
3,783 Views
Yes, this is a bug in Update 3 only. It is fixed in Update 4 (and was not in Update 2). I expect Update 4 to be available late this week. We apologize for the inconvenience. Turning off "Check routine interfaces" is a workaround.
0 Kudos
Michael_D_11
Beginner
3,782 Views
Thanks for the prompt response Steve, I will look for update 4 later this week.
0 Kudos
Reto_W_
Beginner
3,782 Views

Hi Steve

Are you still there?

I think i have the same Problem with: Microsoft Visual Web Developer 2010 and Intel(R) Visual Fortran Composer XE 2013 SP1 Update 3 Integration for Microsoft Visual Studio* 2010, 14.0.0092.2010

P:\FORTRAN\LIB\ENGELN\KAP04\CYCTR.FOR(153): error #7977: The type of the function reference does not match the type of the function definition. [MACHPD]

I think the program was working fine but not anymore after the update.

How can I solve it?

Thank you for your efforts,

Reto

0 Kudos
mecej4
Honored Contributor III
3,782 Views

Please display the source code of CYCTR.f90 or at least the lines where the function MACHPD is declared and where it is referenced in an expression.

If your program relies on implicit typing at the point where MACHPD is referenced, MACHPD() would be an integer function. If the compiler had earlier seen a definition for the function with a different type, it would give an error message. More recent versions of IFort do more thorough type consistency checks on code than earlier versions did. Even if your code used to work correctly, it would be wise to locate and remove the inconsistency now.

0 Kudos
Les_Neilson
Valued Contributor II
3,782 Views

Well one immediate thing I noticed is in CYCTRP where you have

DOUBLE PRECISION ... MACHPD

but MACHPD is declared as INTEGER in the function.

Also. What is this next snippet trying to do?

     FMACHP = 1.0D0
10 FMACHP = 0.5D0 * FMACHP
     IF (MACHPD(1.0D0+FMACHP) .EQ. 1) GOTO 10

FMACHP goes from 1.0 to 0.5 to 0.25 to 0.125 to 0.0625 ... because      1.0 + FMACHP is always greater than 1.0 in function MACHPD

Les

0 Kudos
Arjen_Markus
Honored Contributor I
3,782 Views

It is one of those routines from before the Fortran 90 standard that try to find out the properties of floating-point arithmetic.

There was another thread not long ago, where this was discussed at some length, as the optimiser in Intel Fortran was "too" smart and optimised a crucial element away. However, the routine can easily be reimplemented using one of the numerical inquiry routines.

0 Kudos
Reply