I've never written a Fortran code.
But it seems like you have to declare your variables first, then assign values, which you violate in your code (you declare and assign g on the same line and you declare a after you have assigned value to g).
I suggest having a look on a Fortran tutorial, such as this: https://www.tutorialspoint.com/fortran/index.htm
I played around a bit with the help of some tutorials and this is what I came up with:
program FunctionCallTest
! Declare your variable
real g
real a
! Assign your values
g = 9.8
a = 3
print *, 'func = ', func(a, g)
end program
function func(a, F)
func = a * F
end function func
function F(g)
F = g * 2
end function F
Feel free to modify it to suit your needs.