Here is a listing of the Repeat.f source code used in the following examples:
demo% cat Repeat.f PROGRAM repeat pn1 = REAL( LOC ( rp1 ) ) CALL subr1 ( pn1 ) CALL nwfrk ( pn1 ) PRINT *, pn1 END ! PROGRAM repeat SUBROUTINE subr1 ( x ) IF ( x .GT. 1.0 ) THEN CALL subr1 ( x * 0.5 ) END IF END SUBROUTINE nwfrk( ix ) EXTERNAL fork INTEGER prnok, fork PRINT *, prnok ( ix ), fork ( ) END INTEGER FUNCTION prnok ( x ) prnok = INT ( x ) + LOC(x) END SUBROUTINE unreach_sub() CALL sleep(1) END
Example: Use -XlistE to show errors and warnings:
demo% f77 -XlistE -silent Repeat.f demo% cat Repeat.lst FILE "Repeat.f" program repeat 4 CALL nwfrk ( pn1 ) ^ **** ERR #418: argument "pn1" is real, but dummy argument is integer*4 See: "Repeat.f" line #14 4 CALL nwfrk ( pn1 ) ^ **** ERR #317: variable "pn1" referenced as integer*4 across repeat/nwfrk//prnok in line #21 but set as real by repeat in line #2 subroutine subr1 10 CALL subr1 ( x * 0.5 ) ^ **** WAR #348: recursive call for "subr1". See dynamic calls: "Repeat.f" line #3 subroutine nwfrk 17 PRINT *, prnok ( ix ), fork ( ) ^ **** ERR #418: argument "ix" is integer*4, but dummy argument is real See: "Repeat.f" line #20 subroutine unreach_sub 24 SUBROUTINE unreach_sub() ^ **** WAR #338: subroutine "unreach_sub" isn't called from program Date: Wed Feb 24 10:40:32 1999 Files: 2 (Sources: 1; libraries: 1) Lines: 26 (Sources: 26; Library subprograms:2) Routines: 5 (MAIN: 1; Subroutines: 3; Functions: 1) Messages: 5 (Errors: 3; Warnings: 2) demo%
Compiling the same program with --Xlist also produces a cross-reference table on standard output:
C R O S S R E F E R E N C E T A B L E Source file: Repeat.f Legend: D Definition/Declaration U Simple use M Modified occurrence A Actual argument C Subroutine/Function call I Initialization: DATA or extended declaration E Occurrence in EQUIVALENCE N Occurrence in NAMELIST P R O G R A M F O R M Program ------- repeat <repeat> D 1:D Functions and Subroutines ------------------------- fork int*4 <nwfrk> DC 15:D 16:D 17:C int intrinsic <prnok> C 21:C loc intrinsic <repeat> C 2:C <prnok> C 21:C nwfrk <repeat> C 4:C <nwfrk> D 14:D prnok int*4 <nwfrk> DC 16:D 17:C <prnok> DM 20:D 21:M real intrinsic <repeat> C 2:C sleep <unreach_sub> C 25:C subr1 <repeat> C 3:C <subr1> DC 8:D 10:C unreach_sub <unreach_sub> D 24:D
Output from compiling f77 -Xlist Repeat.f (Continued)
Variables and Arrays -------------------- ix int*4 dummy <nwfrk> DA 14:D 17:A pn1 real*4 <repeat> UMA 2:M 3:A 4:A 5:U rp1 real*4 <repeat> A 2:A x real*4 dummy <subr1> DU 8:D 9:U 10:U <prnok> DUA 20:D 21:A 21:U ---------------------------------------------------------------------- Date: Tue Feb 22 13:15:39 1995 Files: 2 (Sources: 1; libraries: 1) Lines: 26 (Sources: 26; Library subprograms:2) Routines: 5 (MAIN: 1; Subroutines: 3; Functions: 1) Messages: 5 (Errors: 3; Warnings: 2) demo%
In the cross-reference table in the preceding example:
ix is a 4-byte integer:
Used as an argument in the routine nwfrk
At line 14, used as a declaration of argument
At line 17, used as an actual argument
pn1 is a 4-byte real in the routine repeat:
At line 2, modified
At line 3, argument
At line 4, argument
At line 5, used
rp1 is a 4-byte real in the routine, repeat. At line 2, it is an argument.