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

referencing function of derived data type

skibki
Beginner
446 Views

When I try to reference a function of derived data type,I get error compiling the referencing subroutine. Note, no errors compiling function itself and module where derived data type is defined. Interestingly, when I turn off interface routine checking the error goes away and code compiles and performs as expected. Is it compiler bug or smth wrong with my code? Below is text of error and the code. Thanks for any ideas.

-----
Error 1 error #7977: The type of the function reference does not match the type of the function definition. [FUNCUNIT] D:\\Data\\Project\\EngineModel\\Fortran\\ver5.0\\ver5libNew\\engn\\mainUnit.f 8

-----

The derived data type is set in the module unit as follows:

ccc
MODULE TypeDefinitions

type GasProperties

Real Pt,Tt,FA, W

end type

end module

ccc

The function is defined as follows:
ccc
function funcUnit(StaIn) result(StaOut)

use TypeDefinitions

type (GasProperties) StaIn, StaOut

StaOut = StaIn

StaOut.Pt = StaIn.Pt * 2

end function
ccc

The function is referenced in the following subroutine:
ccc

SUBROUTINE mainUnit(StaIn,StaOut)

use TypeDefinitions

IMPLICIT NONE

c ....declare derived data types and functions

type (GasProperties) funcUnit, StaIn, StaOut

StaOut = funcUnit(StaIn)

RETURN

END
ccc

0 Kudos
3 Replies
Steven_L_Intel1
Employee
446 Views
Your code is fine - this is a compiler bug when generated interface checking is enabled (Diagnostics > Check routine interfaces). The error does not occur if an explicit interface is provided, either using an interface block or moving the function into a module.

I have escalated this as issue DPD200157843.
0 Kudos
skibki
Beginner
446 Views
Thanks for very timely, conciseand helpful reply.
0 Kudos
Steven_L_Intel1
Employee
446 Views
I expect this issue to be fixed in update 3 to Intel Visual Fortran Composer XE 2011.
0 Kudos
Reply