home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!pipex!warwick!str-ccsun!str-va!cbas25
- From: cbas25@vaxa.strath.ac.uk
- Subject: Fortran problem on going from 4.0.1 to 4.0.5
- Message-ID: <1992Aug31.161432.1@vaxa.strath.ac.uk>
- Lines: 78
- Sender: news@ccsun.strath.ac.uk (News account )
- Nntp-Posting-Host: vaxe
- Organization: Strathclyde University VAX Cluster
- Date: Mon, 31 Aug 1992 16:14:32 GMT
-
- The following fortran program illustrates a problem which has arisen on
- going from IRIX 4.0.1 to IRIX 4.0.5.
- When compiled under the first version of the operating system the program
- works correctly, and gives the correct results from both subroutines
- (ONCE and DIFFER). When compiled under 4.0.5 the program core-dumps at line
- 42, unless the compilation is done with the keyword '-static'.
-
- A cutdown version in which the subroutine 'ONCE' is not called and the
- routine itself is not present, does run without core-dumping (when compiled
- without '-static') but it appears that the numbers in the second array (XS)
- are not correctly held (all are either zero or very small numbers).
-
- My reading of the the Fortran manual pages leads me to believe that use
- of the 'SAVE' directive in the subroutine DIFFER is the only requirement
- for values to be retained on exit from a subroutine.
-
- I detected this anomaly in a larger program. In this, the use
- of three entry points to a subroutine is used to allow calculations
- to be done on pairs of arrays selected from a much larger number than two.
- Thus if there are n arrays the number of subroutine calls is 2*n rather than
- n**2 (which is the case if both selected arrays are to be passed as
- parameters together in a single subroutine call.
-
- C-------------------------------cut here-------------------------
- PROGRAM TESTPRO
- COMMON/A/XA(10)
- COMMON/B/XB(10)
- DO 100 I = 1,10
- XA(I) = FLOAT(I)
- XB(I) = 10.0 - FLOAT(I)
- 100 CONTINUE
-
- WRITE (*,1000)
- 1000 FORMAT ('Enter to numbers between 1 and 10 inclusive')
- READ (*,*) K,L
-
- CALL DIFF1 (XA)
- CALL DIFF2 (XB)
- CALL DIFF3 (K,L,RESULT)
- WRITE (*,*) RESULT
-
- CALL ONCE (XA,XB,K,L,RESULT)
- WRITE (*,*) RESULT
-
- STOP
- END
-
- SUBROUTINE ONCE (XR,XS,I,J,D)
- DIMENSION XR(10)
- DIMENSION XS(10)
- write (*,*) i,j,xr(i),xs(j)
- D = XR(I) - XS(J)
- RETURN
- END
-
- SUBROUTINE DIFFER
- SAVE
- DIMENSION XR(10)
- DIMENSION XS(10)
- ENTRY DIFF1 (XR)
- RETURN
- ENTRY DIFF2 (XS)
- RETURN
- ENTRY DIFF3 (I,J,D)
- write (*,*) i,j,xr(i),xs(j) !Program fails here when '-static' not used
- D = XR(I) - XS(J)
- RETURN
- END
- C-------------------------------cut here-------------------------
-
- Has anyone had similar problems.
-
- Peter Bladon
- University of Strathclyde
- Department of Pure and Applied Chemistry
- Glasgow G1 1XL
-
- e-mail cbas25%vaxa.strath.ac.uk
-