This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g77 bugs?
- From: Zhiguo Yao <Zhiguo dot Yao at cern dot ch>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Oct 2003 13:16:10 +0200 (CEST)
- Subject: g77 bugs?
Hello,
There is a simple fortran program:
program bugtest
double precision RS2,RC2,B,ff
real RRS2,RRC2,RB
COMMON /FORINT2/ RS2,RC2,B
COMMON /RORINT2/ RRS2,RRC2,RB
external fv700
RS2 = 1.
RC2 = 0.25
B = 0.75
ff = fv700(0.875000004d0)
end
FUNCTION FV700(X)
c from CERNLIB, to test the mathlib
implicit double precision (A-H,O-Z)
COMMON /FORINT2/ RS2,RC2,B
H0=RS2-X**2
H1=MIN(RC2-(X-B)**2,H0)
FV700=SQRT(H1*(H0-H1))+H0*ASIN(SQRT(H1/H0))
write(6,*) 'h0,h1,h0-h1,fv700 =',h0,h1,h0-h1,fv700
RETURN
END
If I compile it with command 'g77 -O -fno-automatic', running of it gives
h0,h1,h0-h1,fv700 = 0.234374993 0.234374993 0. NaN
It is really an undesireable behaviour (the 'NaN'). But if I switch off
any of option '-O' or '-fno-automatic', it gives:
h0,h1,h0-h1,fv700 = 0.234374993 0.234374993 0. 0.368155378
That's fine.
Apparently there are some problems to the intrinsic functions 'MIN'
with the compiling options '-O' and/or '-fno-automatic'.
Such a problem only appears on a cygwin version g77, 'g77 --version'
gives:
GNU Fortran (GCC) 3.3.1 (cygming special)
Copyright (C) 2002 Free Software Foundation, Inc.
I don't know wether it is also a bug of gcc 3.3.1 on other platforms,
I have no chance to test it.
Many thanks
with best regards
Zhiguo YAO
--
Zhiguo Yao EP/LE CERN CH-1211 Geneva 23 Switzerland
mailto: Zhiguo.Yao@cern.ch yorer@hotmail.com
Office: B32 2-C024 Mailbox: J23100
Tel: (+41) 22 76 76319 Fax: (+41) 22 78 28923