This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
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
REAL FUNCTION ZWWE (X, XU, DX, NX, F)
C ====
C
C KURZBESCHREIBUNG: LINEARE INTERPOLATION IN AEQUIDISTANTEM FELD VON
C STUETZWERTEN
C
C AUTOR(EN):
C
C DATUM DER ERSTEN VERSION:
C
C-----------------------------------------------------------------------
C AENDERUNGEN: BESCHREIBUNG DER AENDERUNG
C
C GEAENDERT VON: R. PEREIRA
C DATUM: 25.09.90
C
C R. PEREIRA FALL K1 = NX MITBERUECKSICHTIGT
C 13.09.94
C
C R. Pereira Kein Abbruch bei Stuetzwert ausserhalb
C 21.06.2000 des zulaessiges Bereiches.
C
C-----------------------------------------------------------------------
C AUFRUF: ZWWE (X, XU, DX, NX, F)
C
C BESCHREIBUNG DER PARAMETER:
C
C EINGABE: X - INTERPOLATIONSSTELLE
C XU - KLEINSTER WERT DER STUETZPUNKTKOORDINATEN
C DX - SCHRITTWEITE DER STUETZPUNKTKOORDINATEN
C NX - ANZAHL DER STUETZPUNKTE
C F - FELD DER STUETZWERTE
C
C AUSGABE: ZWWE - INTERPOLATIONSWERT (LOESUNG)
C
C-----------------------------------------------------------------------
C LISTE DER COMMON BLOCKS:
C
C KANAL
C
C LISTE DER VARIABLEN:
C
C VARIABLEN
C
C
C VEKTOREN UND MATRIZEN
C
C
C-----------------------------------------------------------------------
C AUFGERUFENE SUBROUTINES UND FUNCTIONS:
C
C KEINE
C
C BEMERKUNGEN: LIEGT X AUSSERHALB DES DURCH XU, DX UND NX BESTIMMTEN
C BEREICHES, wird der Grenzwert gesetzt.
C
C LITERATUR:
C
C-----------------------------------------------------------------------
IMPLICIT NONE
C
C
C Fuer Ultrix
c INCLUDE '../source/cmn/kanal.cmn'
C Fuer Open/VMS
C INCLUDE '[PEREIRA.SIMBEL.BACKUP.SOURCE]KANAL.CMN'
C
INTEGER K1, NX
REAL X, XU, DX, X1
REAL F(NX)
C
C.......................................................................
write (77,*) 'X, XU, DX, NX = ', X, XU, DX, NX
C
K1=INT((X-XU)/DX+0.001)
write (77,*) 'k1 = ', k1
C
IF (K1 .GE. NX-1) THEN
ZWWE = F(NX)
write (77,*) '1 - zwwe = ', zwwe
RETURN
ELSEIF (K1 .LE. 0) THEN
ZWWE = F(1)
write (77,*) '2 - zwwe = ', zwwe
RETURN
ELSE
X1 = XU+K1*DX
K1 = K1+1
write (77,*) 'x1, k1, dx, f(k1+1), f(k1) = ',
* x1, k1, dx, f(k1+1), f(k1)
ZWWE = (X-X1)/DX*(F(K1+1)-F(K1))+F(K1)
write (77,*) '3 - zwwe = ', zwwe
ENDIF
C
RETURN
END
C ENDE -ZWWE-
C***********************************************************************
C***********************************************************************
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |