integer function returns NaN



Hi,

I am trying to do a simple exercise in a Fortran book: "concatenating"
two integers, eg 19,95 => 1995.

I wrote the following:

program iconcat
integer :: a,b
read (*,*) a,b
write (*,*) cc(a,b)
end program iconcat

integer function cc(a,b)
integer, intent(in) :: a,b
integer :: m
m = floor(log10(real(b)))+1
write (*,*) 10**m*a+b ! I want this in cc ...
cc = 10**m*a+b
end function cc

When I run the program, the write statement in the function displays
the result correctly, but the write statement in the program doesn't,
eg

$ a.out
1 2
12
NaN

Maybe the error is obvious but I don't see it. The compiler is f95.

Tamas

.