g77: Different results when compiling with/without -fbounds-check ?!
Richard Ems
r.ems.mtg@gmx.net
Wed Jul 12 08:41:00 GMT 2000
ÃÂ
ÃÂ
Hi all,
After 2 days searching for errors and comparing my test case result's
with different option combinations, I found
that compiling with -fbounds-check and without it returns (for my test
case) different results.
Attached are my two files, the main program file and the subroutine
one.
After running:
clear
set -x
for OPT in O0 O3
do
ÃÂ g77 -$OPT -o testit-$OPT testit.f zwwe.f && time ./testit-$OPT
ÃÂ mv -f fort.77 fort-$OPT.77
done
diff fort-O0.77 fort-O3.77
set +x
(the same in one line:ÃÂ ÃÂ clear ; set -x ; for OPT in O0 O3
; do g77 -$OPT -o testit-$OPT testit.f zwwe.f && time ./testit-$OPT
&& mv -f fort.77 fort-$OPT.77 ; done && diff fort-O0.77
fort-O3.77 ; set +xÃÂ ÃÂ )
several times, I get no differences from the diff command. As you can
see, I'm compiling WITHOUT -fbounds-check.
Running the same, also several times, but now compiling WITH -fbounds-check,
I get different results for the executable compiled with -O0 and the one
compiled with -O3.
( The same as above WITH -fbaound-check :
clear ; set -x ; for OPT in O0 O3 ; do g77 -fbounds-check -$OPT -o
testit-$OPT testit.f zwwe.f && time ./testit-$OPT && mv
-f fort.77 fort-$OPT.77 ; done && diff fort-O0.77 fort-O3.77 ;
set +xÃÂ ÃÂ )
Is this supposed to behave like this? I suppose not!
I'm runing on SuSE Linux 6.4, kernel 2.2.16
g77 --version: GNU Fortran 0.5.25 19991030 (prerelease)
gcc --version: 2.95.2
as --version:GNU assembler 2.9.5
ÃÂ
Many thanks, Richard Ems
ÃÂ
ÃÂ
--ÃÂ
ÃÂ ÃÂ Richard Ems
ÃÂ ÃÂ ... e-mail: r.ems@gmx.net
ÃÂ ÃÂ ... Computer Science, University of Hamburg
ÃÂ ÃÂ Unix IS user friendly. It's just selective about who its friends are.
ÃÂ
ÃÂ
ÃÂ
ÃÂ
ÃÂ
ÃÂ
ÃÂ
ÃÂ
program testit
c
implicit none
c
integer i, mynx
parameter (mynx=100)
real a, myx, myxu, mydx, zwwe
real myf(mynx)
c
myx = acos(-1.)
myxu = 1.0
mydx = 1.0
c
do 1 i=1,mynx,1
myf(i) = real(i)/100000*rand(i)
1 continue
c
do 2 i=1,10000,1
myx = myx*(rand(i)+0.6)
write (77,*) 'in testit: vor zwwe: ', myx, myxu, mydx, mynx
a = zwwe(myx, myxu, mydx, mynx, myf)
write (77,*) 'in testit: a = ', a
2 continue
c
end
c
More information about the Gcc-bugs
mailing list