Strange behavior using a module which uses another module
- From: deltaquattro <deltaquattro@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 09:27:33 -0700 (PDT)
Hi,
it's me again :-) I'm testing my function libraries against a standard
library and I don't understand what's happening. The libraries I
developed are called md_Jacobi and md_Global_funcs. The standard
library function is dgamma.f from SPECFUN.
module md_Global_funcs
contains
....
real function lgamma(x)
....
write(*,*) 'foo' ! Keep in mind this instruction...
....
end function lgamma
....
end module md_Global_funcs
module md_Jacobi
use md_Global_funcs
.....
end module md_Jacobi
program main
use md_Jacobi
external dgamma
.....
do i=1,10
write(*,*) 'x', i, 'dgamma', dgamma(real(i)), 'gamma',
gamma(real(i)), 'n!',factorial(i), lgamma(real(i))
end do
.....
end program main
1) I was surprised that main was able to access gamma, lgamma and
factorial, defined in md_Global_funcs, since main only uses md_Jacobi
and not md_Global_funcs. However, I looked at MRC and found that since
md_Jacobi uses md_Global_funcs, then main has access to it also. Is it
possible to let a program unit A use a module B, without having access
to any module used by B unless explicitly used by A?
2) compiling with EFC, I get the following error:
forrtl: severe (40): recursive I/O operation, unit -1, file unknown
Image PC Routine Line
Source
main 40000000000C6190 Unknown Unknown
Unknown
main 40000000000C2620 Unknown Unknown
Unknown
main 40000000000B5050 Unknown Unknown
Unknown
main 4000000000044D20 Unknown Unknown
Unknown
main 4000000000022D00 Unknown Unknown
Unknown
main 4000000000005E40 Unknown Unknown
Unknown
main 400000000000D450 Unknown Unknown
Unknown
main 4000000000002C80 Unknown Unknown
Unknown
libc.so.6.1 20000000003CDC50 Unknown Unknown
Unknown
main 40000000000029C0 Unknown Unknown
Unknown
due to the "write" instruction in lgamma. Why is the compiler
complaining about a recursive I/O? How can I use print/write
statements to debug my libraries without incurring in this error?
Thanks,
Best Regards,
deltaquattro
.
- Follow-Ups:
- Re: Strange behavior using a module which uses another module
- From: Steven G. Kargl
- Re: Strange behavior using a module which uses another module
- From: Tobias Burnus
- Re: Strange behavior using a module which uses another module
- From: Ron Shepard
- Re: Strange behavior using a module which uses another module
- Prev by Date: Re: Compiling SPECFUN and similar libraries
- Next by Date: Re: Strange behavior using a module which uses another module
- Previous by thread: Compiling SPECFUN and similar libraries
- Next by thread: Re: Strange behavior using a module which uses another module
- Index(es):
Relevant Pages
|