此处列出了下列示例中使用的 Repeat.f 源代码:
demo% cat Repeat.f
PROGRAM repeat
pn1 = 27.005
CALL subr1 ( pn1 )
CALL newf ( pn1 )
PRINT *, pn1
END
SUBROUTINE subr1 ( x )
IF ( x .GT. 1.0 ) THEN
CALL subr2 ( x * 0.5 )
END IF
END
SUBROUTINE newf( ix )
INTEGER PRNOK
IF (ix .eq. 0) THEN
ix = -1
ENDIF
PRINT *, prnok ( ix )
END
INTEGER FUNCTION prnok ( x )
prnok = INT ( x ) + .05
END
SUBROUTINE unreach_sub()
CALL sleep(1)
END
SUBROUTINE subr2 (x)
CALL subr1(x+x)
END
|
示例:使用 -XlistX 显示错误、警告和交叉引用
demo% f95 -XlistX Repeat.f
demo% cat Repeat.lst
Repeat.f Mon Mar 18 18:08:27 2002 page 1
FILE "Repeat.f"
program repeat
4 CALL newf ( pn1 )
^
**** ERR #418: argument "pn1" is real, but dummy argument is integer
See: "Repeat.f" line #14
5 PRINT *, pn1
^
**** ERR #570: variable "pn1" referenced as real but set as integer in
line #4
subroutine newf
19 PRINT *, prnok ( ix )
^
**** ERR #418: argument "ix" is integer, but dummy argument is real
See: "Repeat.f" line #22
function prnok
23 prnok = INT ( x ) + .05
^
**** WAR #1024: suspicious assignment a value of type "real*4" to a
variable of type "integer*4"
subroutine unreach_sub
26 SUBROUTINE unreach_sub()
^
**** WAR #338: subroutine "unreach_sub" never called from program
subroutine subr2
31 CALL subr1(x+x)
^
**** WAR #348: recursive call for "subr1". See dynamic calls:
"Repeat.f" line #10
"Repeat.f" line #3
Cross Reference Mon Mar 18 18:08:27 2002 page 2
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
L Use Module
Cross Reference Mon Mar 18 15:40:57 2002 page 3
P R O G R A M F O R M
Program
-------
repeat <repeat> D 1:D
Cross Reference Mon Mar 18 15:40:57 2002 page 4
Functions and Subroutines
-------------------------
INT intrinsic
<prnok> C 23:C
newf <repeat> C 4:C
<newf> D 14:D
prnok int*4 <newf> DC 15:D 19:C
<prnok> DM 22:D 23:M
sleep <unreach_sub> C 27:C
subr1 <repeat> C 3:C
<subr1> D 8:D
<subr2> C 31:C
subr2 <subr1> C 10:C
<subr2> D 30:D
unreach_sub <unreach_sub> D 26:D
Cross Reference Mon Mar 18 15:40:57 2002 page 5
Variables and Arrays
--------------------
ix int*4 dummy
<newf> DUMA 14:D 16:U 17:M 19:A
pn1 real*4 <repeat> UMA 2:M 3:A 4:A 5:U
x real*4 dummy
<subr1> DU 8:D 9:U 10:U
<subr2> DU 30:D 31:U 31:U
<prnok> DA 22:D 23:A
------------------------------------------------------------------
STATISTIC Mon Mar 18 15:40:57 2002 page 6
Date: Mon Mar 18 15:40:57 2002
Options: -XlistX
Files: 2 (Sources: 1; libraries: 1)
Lines: 33 (Sources: 33; Library subprograms:1)
Routines: 6 (MAIN: 1; Subroutines: 4; Functions: 1)
Messages: 6 (Errors: 3; Warnings: 3)
|