[comp.lang.fortran] need help in sun fortran

Lal <lal@sun.soe.clarkson.edu> (03/20/91)

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

khb@chiba.Eng.Sun.COM (Keith Bierman fpgroup) (03/21/91)

.... on my system running f77v1.3.1
f77 bar.f && a.out
bar.f:
 MAIN:
	tvdx:
  1
  1
  1.... lots of 1's deleted
  1
  1
  1
  1
chiba:/net/chiba/home2/khb>

It also works with f77v1.4.

It sounds like you have a local installation error. I suggest you chat
with your support folks rather than take up net bandwidth about this.
--
----------------------------------------------------------------
Keith H. Bierman    kbierman@Eng.Sun.COM | khb@chiba.Eng.Sun.COM
SMI 2550 Garcia 12-33			 | (415 336 2648)   
    Mountain View, CA 94043

khb@chiba.Eng.Sun.COM (Keith Bierman fpgroup) (03/21/91)

In article <KHB.91Mar20131329@chiba.Eng.Sun.COM> khb@chiba.Eng.Sun.COM (Keith Bierman fpgroup) writes:

   It sounds like you have a local installation error....

A likely candiate for this error, is using TMPFS w/o the OS patch
to it. Which if memory serves, is 

	4.1   100089-04 \
			 |--->	  fixes for various tmpfs bugs
	4.1.1 100174-01 /

Alternatively you can unconfigure the TMPFS option. However, I have
obtained up to 2x compile time speedups (with 32Mb RAM) so I'd go for
the patch if I were you.
--
----------------------------------------------------------------
Keith H. Bierman    kbierman@Eng.Sun.COM | khb@chiba.Eng.Sun.COM
SMI 2550 Garcia 12-33			 | (415 336 2648)   
    Mountain View, CA 94043