Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!clarkson!sun.soe.clarkson.edu!lal Date: Wed, 20 Mar 91 14:54:37 EST From: Lal Message-Id: <9103201954.AA07976@sun.soe.clarkson.edu> Subject: need help in sun fortran Newsgroups: comp.lang.fortran Need some help ! Following is a 34 line sample of a program, that gives a wrong result with the FORTRAN compiler (operating system 4.1.1) in SPARC 1+ station. I get the correct result with Lahey, WATFOR77, compilers in PC, and IBM VS FORTRAN II and other mainframe computers. I am supposed to get 1 1 1 1 1 etc as my output as you can see in the program. Instead, I get different values. This time, I get 528941399. I appreciate any suggestions to overcome this problem in SUN4. C==================PROGRAM==tmp.f======================== PARAMETER (KX=12,KY=12) COMPLEX SN1,SN2 COMMON /GEOM/ SN1(KX,KY),SN2(KX,KY) DIMENSION U1(KX,KY),U2(KX,KY) n=12 M=12 DO 10 IT=1,5 DO 1 I=1,4 DO 1 J=1,4 CALL TVDX (N,M,U1,U2) C=C+1.0 1 CONTINUE C=0.0 10 CONTINUE STOP END SUBROUTINE TVDX (N,M,U1,U2) PARAMETER (KX=12,KY=12) COMPLEX SN1,SN2 COMMON /GEOM/ SN1(KX,KY),SN2(KX,KY) DIMENSION U1(N,M),U2(N,M) SAVE ISPO1,XP DATA ISPO1,XP/0,.5/ IF (ISPO1 .EQ. 0) THEN N1 = N - 1 M1 = M - 1 ISPO1 = 1 ENDIF do 10 i=1,n 10 x=x+1.0 s=0.1 print*,ispo1 RETURN END C=============script========================== Script started on Thu Mar 14 23:25:57 1991 water {51} % f77 -g tmp.f -o tmp tmp.f: MAIN: tvdx: water {52} % tmp 528941399 528941399 528941399 528941399 528941399 528941399 528941399 water {53} % ^C water {53} % exit water {54} % script done on Thu Mar 14 23:26:23 1991