gfortran and g77 gives different output for same program
prakash Taksali
taksali@gmail.com
Tue Mar 14 14:29:00 GMT 2006
I wrote a sample fortran program for this problem -
Fortran program test.f --
IMPLICIT NONE
REAL*8 X1, Y1, X2, Y2, LENGHT
C READ *, X1, Y1, X2, Y2
X1 = '3FEF6EFA44990F7F'Z
Y1 = '3FEF6EFA44990F7F'Z
X2 = '3FEF6EFA44990F7F'Z
Y2 = '3FEF6EFA44990F7F'Z
WRITE (*,71) , 'LENGHT is ', X1
LENGHT=SQRT((X2-X1)**2 + (Y2-Y1)**2)
PRINT *, 'LENGHT is ', LENGHT
LENGHT=X1 * X2
WRITE (*, 71) , 'LENGHT is ', LENGHT
71 format(1x,a10,2x,z16)
END
Compiled it on ltbbuild (This machine has SUSE linux distribution)
machine like this : g77 test.f
Executed like this :
ptaksali@ltsbuild:~> ./a.out
LENGHT is 3FEF6EFA44990F7F
LENGHT is 0.
LENGHT is 3FEEE085C5257ABB
Compiled it on cpbwbuild (This machine has FC5) machine like this:
gfortran -ff2c test.f
Executed like this :
[ptaksali@cpbwbuild for_prog]$ ./a.out
LENGHT is 43CFF7B77D224C88
LENGHT is 0.00000000000000
LENGHT is 47AFEF711F2A56E7
We can see from above output that same program gives two different
output on different machine.
Pls note that compiler option "-ff2c" does not affect the output.
Can some one from community explain me the reason behind two different
output and how to fix this problem.
Thanks
--Prakash
More information about the Fortran
mailing list