Trying to find source of gfortran problems in Ubuntu
FX Coudert
fxcoudert@gmail.com
Thu Feb 28 21:38:00 GMT 2008
> Yes, I did, reproduce it with a 4.3 compiler--on OS X.
I can reproduce it on Intel MacOS 10.4.11, XCode 2.5, GNU Fortran
version 4.3.0 20071231, gcc and g++ version 4.0.1 (Apple Computer,
Inc. build 5370). I tried a normal build, and one with --enable-debug
and all flags using -O0 -g. Both generate NaNs in the output.
Now, to debug that further, you need to find the first place where a
NaN is output, and set a breakpoint there. Then, slowly, work your
way back to where it initially appeared.
What is weird is that you said the NaNs disappear if you add WRITE
statements, which is usually a sign that the NaNs are due to
excessive optimization (either because the compiler does something
illegal, or because the program relies on something that's not
guaranteed under optimization). But... in your case, you still get
the NaNs at -O0.
One thing I can think of (as a way of getting a NaN that isn't
trapped by -ffpe-trap=invalid,overflow) is that you might have a
value that's used without being set. Try compiling with -O2 -W -Wall
and see how many "may be used uninitialized" warnings are issued
(especially in the code that is used by this particular testcase). In
particular:
> gfortran -DHAVE_CONFIG_H -I. -I. -I../.. -I../defs -I./../defs -
> O2 -W -Wall -c -o opernla_ylm.o opernla_ylm.F90
> opernla_ylm.F90: In function ‘opernla_ylm’:
> opernla_ylm.F90:125: warning: ‘buffer_r1’ may be used uninitialized
> in this function
> opernla_ylm.F90:123: warning: ‘buffer_i1’ may be used uninitialized
> in this function
and maybe (I've never seen that before, don't know how legal it is):
> nonlop_ylm.F90:591.16:
>
> call strconv(work,gprimd,work)
> 1
> Warning: Same actual argument associated with INTENT(IN) argument
> 'frac' and INTENT(OUT) argument 'cart' at (1)
> nonlop_ylm.F90:594.15:
>
> call strconv(strnlk,gprimd,strnlk)
> 1
> Warning: Same actual argument associated with INTENT(IN) argument
> 'frac' and INTENT(OUT) argument 'cart' at (1)
One last thing: have you tried linking to other BLAS and LAPACK
libraries? That might give you an easy way to eliminate some of the
usual suspects :)
Thanks,
FX
--
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/
More information about the Fortran
mailing list