Diagnostic 7977: The type of the function reference does not match the type of the function definition.

Diagnostic 7977: The type of the function reference does not match the type of the function definition.

This diagnostic is given when the compiler detects that the data type of a function is different between a place where it is called and the function itself. The compiler is able to compare these when the "warn interfaces" option is enabled - this is on by default in Visual Studio projects on Windows. The Fortran standard requires that the type and kind of a function be the same across the definition and all references.

An example:

program test
real f
print *, f(3)
end
double precision function f (i)
integer i
f = i
end

Here, the type of function f is single precision real (real(4)) in the program where it is called, but double precision (real(8)) in the actual function. A mismatch of this nature usually causes the function result to be incorrectly interpreted, and in some cases can lead to other errors.

To correct the problem, make sure that declarations of functions match that of the function itself. If the function is declared in a module, this provides an explicit interface that eliminates the need for a separate declaration and is a recommended practice.

For more help with this diagnostic, please ask in our user forum (Windows, Linux, OS X)

For more complete information about compiler optimizations, see our Optimization Notice.