I am having an issue with the declared type of the return value of a function not being recognized in its call. This function clearly has its return value declared as complex*16: Code (Fortran): !----------4-vector dot product under Minkowski metric---------- function dot4(v1,v2) result(res) implicit none complex*16 v1(4),v2(4) complex*16, dimension(0):: res res=v1(1)*v2(1)-v1(2)*v2(2)-v1(3)*v2(3)-v1(4)*v2(4) return end But then when I try to call dot4 from another function as such: Code (Fortran): !----------laser-dressed 4-vec---------- function bar(v,k,mu) result(res) implicit none complex*16 v(4),k(4) complex*16, dimension(4):: res real*8 me,c, mu me=9.10938291E-31 !electron rest mass, in kg c=137.0 !speed of light, in au res=v+((mu*me*c)**2)/(4*dot4(k,v))*k return end it throws the following error on compiling (g95): I can't declare dot4 in the "bar" function because it would then be considered a local variable instead of a function being called. This creates the error of "dot4(k,v)" trying to look for a matrix element in dot4, causing a type mismatch within "bar". I was searching for information about this issue and saw that using modules and public statements may help, but I am confused as to how these work. Is this the right direction to be looking in, or is it some other syntax issue? Thanks.