1FTNCHEK 3.3(1L) FTNCHEK 3.3(1L)
2
3
4
6 ftnchek - Fortran 77 program checker
7
9 ftnchek [ -arguments[=list] ] [ -array[=list] ]
10 [ -[no]brief ] [ -calltree[=list] ] [ -[no]check ]
11 [ -columns[=num] ] [ -common[=list] ]
12 [ -[no]crossref[=list] ] [ -[no]declare ]
13 [ -[no]division ] [ -errors[=num] ] [ -[no]extern ]
14 [ -[no]f77[=list] ] [ -[no]f90[=list] ]
15 [ -[no]f95[=list] ] [ -[no]help ]
16 [ -[no]identifier-chars[=list] ] [ -include=str ]
17 [ -intrinsic[=list] ] [ -[no]library ] [ -[no]list ]
18 [ -makedcls[=list] ] [ -mkhtml[=list] ]
19 [ -[no]novice ] [ -output=str ]
20 [ -pointersize[=num] ] [ -[no]portability[=list] ]
21 [ -[no]pretty[=list] ] [ -project[=list] ]
22 [ -[no]pure ] [ -[no]quiet ] [ -[no]reference ]
23 [ -[no]resources ] [ -[no]sixchar ] [ -[no]sort ]
24 [ -source[=list] ] [ -style[=list] ] [ -[no]symtab ]
25 [ -[no]truncation[=list] ] [ -usage[=list] ]
26 [ -[no]vcg ] [ -[no]version ] [ -[no]volatile ]
27 [ -wordsize[=num] ] [ -wrap[=num] ] [ files ... ]
28
30 ftnchek (short for Fortran checker) is designed to detect certain
31 errors in a Fortran program that a compiler usually does not. ftnchek
32 is not primarily intended to detect syntax errors. Its purpose is to
33 assist the user in finding semantic errors. Semantic errors are legal
34 in the Fortran language but are wasteful or may cause incorrect opera‐
35 tion. For example, variables which are never used may indicate some
36 omission in the program; uninitialized variables contain garbage which
37 may cause incorrect results to be calculated; and variables which are
38 not declared may not have the intended type. ftnchek is intended to
39 assist users in the debugging of their Fortran program. It is not
40 intended to catch all syntax errors. This is the function of the com‐
41 piler. Prior to using ftnchek, the user should verify that the program
42 compiles correctly.
43
44 This document first summarizes how to invoke ftnchek. That section
45 should be read before beginning to use ftnchek. Later sections
46 describe ftnchek's options in more detail, give an example of its use,
47 and explain how to interpret the output. The final sections mention
48 the limitations and known bugs in ftnchek.
49
51 ftnchek is invoked through a command of the form:
52
53 $ ftnchek [-option -option ...] filename [filename ...]
54
55 The brackets indicate something which is optional. The brackets them‐
56 selves are not actually typed. Here options are command-line switches
57 or settings, which control the operation of the program and the amount
58 of information that will be printed out. If no option is specified,
59 the default action is to print error messages, warnings, and informa‐
60 tional messages, but not the program listing or symbol tables.
61
62 Each option begins with the '-' character. (On VAX/VMS or MS-DOS sys‐
63 tems you may use either '/' or '-'.) For the sake of conformity with
64 an increasingly common convention, options can also begin with '--'.
65 The options are described at greater length in the next section.
66
67 ftnchek options fall into two categories: switches, which are either
68 true or false, and settings, which have a numeric or string value. The
69 name of a switch is prefixed by 'no' or 'no-' to turn it off: e.g.
70 -nopure would turn off the warnings about impure functions. The 'no'
71 prefix can also be used with numeric settings, having the effect of
72 turning off the corresponding warnings. Settings that control lists of
73 warnings have a special syntax discussed below. Only the first 3 char‐
74 acters of an option name (not counting the '-') need be provided. A
75 colon may be used in place of an equals sign for numeric or string set‐
76 ting assignments; however, we show only the equals sign form below.
77
78 The switches and settings which ftnchek currently recognizes are listed
79 below. For each option, the default is the value used if the option is
80 not explicitly specified, while the turn-on is the value used if the
81 option is given without assigning it a value.
82
83 -arguments=list
84 Control warnings about subprogram type and argument mismatches.
85 Default = turn-on = all.
86
87 -array=list
88 Control warnings in checking array arguments of subprograms.
89 Default = turn-on = all.
90
91 -brief Use shorter format for some error messages. Default = no.
92
93 -calltree=list
94 Produce subprogram call hierarchy in one of 3 formats: text
95 call-tree, who-calls-who and VCG. Default = none, turn-on =
96 tree,prune,sort.
97
98 If the -mkhtml option is invoked and tree is the applied call‐
99 tree option, a file named CallTree.html, will be produced
100 depicting the tree in HTML format.
101
102 -check Perform checking. Default = yes.
103
104 -columns=num
105 Set maximum line length to num columns. (Beyond this is
106 ignored.) Turn-on = max = 132. Default = 72.
107
108 -common=list
109 Set degree of strictness in checking COMMON blocks. Default =
110 turn-on = all.
111
112 -crossref=list
113 Print cross-reference list of subprogram calls, label usage,
114 and/or COMMON block use. Default = none.
115
116 -declare
117 Print a list of all identifiers whose datatype is not explicitly
118 declared. Default = no.
119
120 -division
121 Warn wherever division is done (except division by a constant).
122 Default = no.
123
124 -errors=num
125 Set the maximum number of error messages per cascade. Default =
126 turn-on = 3.
127
128 -extern
129 Warn if external subprograms which are invoked are never
130 defined. Default = yes.
131
132 -f77=list
133 Control specific warnings about supported extensions to the For‐
134 tran 77 Standard. Default = none, turn-on = all.
135
136 -f90=list
137 Control specific warnings about supported extensions to the For‐
138 tran 77 Standard that were not adopted as part of the Fortran 90
139 Standard. Default = none, turn-on = all.
140
141 -f95=list
142 Control specific warnings about standard Fortran 77 features
143 that were deleted from the Fortran 95 Standard. Default =
144 none, turn-on = all.
145
146 -help Print command summary. Default = no.
147
148 -identifier-chars=list
149 Define non-alphanumeric characters that may be used in identi‐
150 fiers. Default = turn-on = dollar sign and underscore.
151
152 -include=path
153 Define a directory to search for INCLUDE files before searching
154 in the system-wide directory. Cumulative. Default = turn-on =
155 none.
156
157 -intrinsic=list
158 Control treatment of nonstandard intrinsic functions. Default =
159 all except vms for Unix version, all except unix for VMS ver‐
160 sion, all except unix and vms for other versions. Turn-on =
161 all.
162
163 -library
164 Begin library mode: do not warn about subprograms in file that
165 are defined but never used. Default = no.
166
167 -list Print source listing of program. Default = no.
168
169 -makedcls=list
170 Prepare a file of declarations. The list specifies options for
171 the format of this file. Default = none, turn-on = declara‐
172 tions.
173
174 -mkhtml=list
175 Create individual HTML document files from ftnchek analysis and
176 code comments. Usually you will also want to specify -call=tree
177 to create the root HTML file CallTree.html. Default = none,
178 turn-on = documents.
179
180 -novice
181 Give output suitable for novice users. Default = yes.
182
183 -output=filename
184 Send output to the given file. Default and turn-on sends output
185 to the screen. (Default filename extension is .lis).
186
187 -pointersize=num
188 Set the size of ``Cray pointer'' variables to num bytes. Min =
189 1, max = 16. Default = turn-on = 4
190
191 -portability=list
192 Warn about non-portable usages. Default = none, turn-on = all.
193
194 -pretty=list
195 Give warnings for possibly misleading appearance of source code.
196 Default = turn-on = all.
197
198 -project=list
199 Create project file (see explanation below). Default = no.
200
201 -pure Assume functions are pure, i.e. have no side effects. Default =
202 yes.
203
204 -quiet Produce less verbose output. Default = no.
205
206 -reference
207 Print table of subprograms referenced by each subprogram.
208 Default = no.
209
210 -resources
211 Print amount of resources used in analyzing the program.
212 Default = no.
213
214 -sixchar
215 List any variable names which clash at 6 characters length.
216 Default = no.
217
218 -sort Print list of subprograms sorted in prerequisite order. Default
219 = no.
220
221 -source=list
222 Select source formatting options: fixed or free form, DEC For‐
223 tran tab-formatted lines, VMS-style INCLUDE statement, UNIX-
224 style backslash escape sequences, and implicit typing of parame‐
225 ters. Default = none, turn-on = all.
226
227 -style=list
228 Produce extra-picky warnings about obsolescent or old-fashioned
229 programming constructions. Default = none, turn-on = all.
230
231 -symtab
232 Print symbol table and label table for each subprogram. Default
233 = no.
234
235 -truncation=list
236 Check for possible loss of accuracy by truncation. Default =
237 turn-on = all.
238
239 -usage=list
240 Control warnings about unused or uninitialized variables, common
241 blocks, etc. Default = turn-on = all.
242
243 -vcg Produce VCG format of call graph.
244
245 -version
246 Print version number. Default = no.
247
248 -volatile
249 Assume COMMON blocks lose definition between activations.
250 Default = no. (Obsolete. Use -common=volatile instead.)
251
252 -wordsize=num
253 Set the default word size for numeric quantities to num bytes.
254 Default = turn-on = 4 bytes.
255
256 -wrap=num
257 Set output column at which to wrap long error messages and warn‐
258 ings to the next line. If set to 0, turn off wrapping. Default
259 = turn-on = 79.
260
261 When more than one option is used, they should be separated by a blank
262 space, except on systems such as VMS where options begin with slash ( /
263 ). No blank spaces may be placed around the equals sign ( = ) in a
264 setting. ftnchek "?" will produce a command summary listing all
265 options and settings.
266
267 For settings that take a list of keywords, namely -arguments, -array,
268 -calltree, -common, -crossref, -f77, -f90, -f95, -intrinsic, -makedcls,
269 -mkhtml, -portability, -pretty, -project, -source, -style, -truncation,
270 and -usage, the list consists of keywords separated by commas or
271 colons. If the list of keywords is omitted, the effect is to set the
272 option to its turn-on value (same as ``all'' in most cases). Also, if
273 the list is omitted, the setting name can be prefixed with no or no- to
274 turn off all the options it controls. For example, -f77 turns on all
275 warnings about nonstandard constructions, while -nof77 turns them all
276 off. Three special keywords are:
277
278 help Print out all the option keywords controlled by the setting,
279 with a brief explanation of their meanings. This keyword cannot
280 be given in a list with other keywords.
281
282 all Set all options. This turns on all options controlled by the
283 setting.
284
285 none Clear all options. This turns off all options controlled by the
286 setting.
287
288 These three special keywords must be given in full. For all other key‐
289 words, only as many letters of the keyword as are necessary to identify
290 it unambiguously need be given, or a wildcard pattern may be used.
291 Including a keyword in the list turns the corresponding option on. For
292 example, -f77=intrinsic would turn on only the warnings about use of
293 nonstandard intrinsic functions. Prefixing a keyword by no- turns its
294 option off. For example, -pretty=no-long-line turns off warnings about
295 lines exceeding 72 columns in length while leaving all other warnings
296 about misleading appearance in effect. If a setting has default none,
297 you can turn on all options except one or two by using all first. For
298 example, -f77=all,no-include enables warnings about all nonstandard
299 extensions except INCLUDE statements. If a setting has default all,
300 you can turn off all warnings except one or two by using none first.
301 For example, -truncation=none,demotion would turn off all precision
302 related warnings except about demotions. Wildcard patterns contain an
303 asterisk to stand for any string of characters. If a wildcard pattern
304 is used, all the warnings that match it are affected. If no- is pre‐
305 fixed to the pattern, all the matching warnings are turned off, other‐
306 wise they are all turned on. The minimum unambiguous length rule does
307 not apply to wildcard matching. For example, use -usage=no-*var* to
308 turn off all warnings relating to variable usage (both local and com‐
309 mon). (Unix users may need to quote any options containing wildcards
310 in order to prevent the shell from attempting to expand them.) Wild‐
311 cards are recognized only in lists of warning keywords, not in the top-
312 level options themselves.
313
314 When ftnchek starts up, it looks for environment variables and also for
315 a preferences file. Any options defined in the environment or in the
316 preferences file are used as defaults in place of the built-in
317 defaults. They are over-ridden by any command line options. See the
318 section on changing the defaults for details about the environment
319 options and the preferences file.
320
321 When giving a name of an input file, the extension is optional. If no
322 extension is given, ftnchek will first look for a project file with
323 extension .prj, and will use that if it exists. If not, then ftnchek
324 will look for a Fortran source file with the extension .for for VMS
325 systems, .f for UNIX systems. More than one file name can be given to
326 ftnchek, and it will process the modules in all files as if they were
327 in a single file.
328
329 Wildcards are allowed in the specification of filenames on the command
330 line for the VMS and MS-DOS versions, as also of course under UNIX and
331 any other system that performs wildcard expansion in the command pro‐
332 cessor.
333
334 If no filename is given, ftnchek will read input from the standard
335 input.
336
338 This section provides a more detailed discussion of ftnchek command-
339 line options. Options and filenames may be interspersed on a command
340 line. Most options are positional: each option remains in effect from
341 the point it is encountered until it is overridden by a later change.
342 Thus for example, the listing may be suppressed for some files and not
343 for others. Exceptions are: the -intrinsic, -pointersize, and -word‐
344 size settings, which cannot be changed once processing of input files
345 has started; the -arguments, -array, -calltree, -common, -crossref,
346 -extern, -reference, -resources, -sort, -vcg, and -volatile options,
347 where the action depends only on the value of the option after the pro‐
348 cessing of input files is finished; and the -include setting, which is
349 cumulative.
350
351 The option names in the following list are in alphabetical order.
352
353
354 -arguments=list
355 Controls warnings about mismatches between actual and dummy sub‐
356 program arguments, and also about mismatches between expected
357 and actual subprogram type. (An actual argument is an argument
358 passed to the subprogram by the caller; a dummy argument is an
359 argument received by the subprogram.) By default, all warnings
360 are turned on.
361
362 The list consists of keywords separated by commas or colons.
363 Since all these warnings are on by default, include a keyword
364 prefixed by no- to turn off a particular warning. There are
365 three special keywords: all to turn on all the warnings about
366 arguments, none to turn them all off, and help to print the list
367 of all the keywords with a brief explanation of each. If list
368 is omitted, -arguments is equivalent to -arguments=all, and
369 -noarguments is equivalent to -arguments=none. The warning key‐
370 words with their meanings are as follows:
371
372 arrayness:
373 warn about inconsistent use of arguments that are arrays.
374 These warnings can be further controlled by the -array
375 option.
376
377 type:
378 warn about dummy arguments of a different data type from the
379 actual arguments.
380
381 function-type:
382 warn if the invocation assumes the function's return value
383 is a different type than it actually is. Also warns if a
384 function is called as a subroutine, or vice-versa.
385
386 number:
387 warn about invoking a subprogram with a different number of
388 arguments than the subprogram expects.
389
390 For compatibility with previous versions of ftnchek, a numeric
391 form of this setting is also accepted: the list is replaced by a
392 number from 0 to 3. A value of 0 turns all the warnings off, 1
393 turns on only number, 2 turns on all except number, and 3 turns
394 all the warnings on.
395
396 This setting does not apply to checking invocations of intrinsic
397 functions or statement functions, which can only be turned off
398 by the -nocheck option.
399
400 See also: -array, -library, -usage.
401
402
403 -array=list
404 Controls the degree of strictness in checking agreement between
405 actual and dummy subprogram arguments that are arrays. The
406 warnings controlled by this setting are for constructions that
407 might legitimately be used by a knowledgeable programmer, but
408 that often indicate programming errors. By default, all warn‐
409 ings are turned on.
410
411 The list consists of keywords separated by commas or colons.
412 Since all these warnings are on by default, include a keyword
413 prefixed by no- to turn off a particular warning. There are
414 three special keywords: all to turn on all the warnings about
415 array arguments, none to turn them all off, and help to print
416 the list of all the keywords with a brief explanation of each.
417 If list is omitted, -array is equivalent to -array=all, and
418 -noarray is equivalent to -array=none. The warning keywords
419 with their meanings are as follows:
420
421 dimensions:
422 warn if the arguments differ in their number of dimensions,
423 or if the actual argument is an array element while the
424 dummy argument is a whole array.
425
426 size:
427 warn if both arguments are arrays, but they differ in number
428 of elements.
429
430 For compatibility with previous versions of ftnchek, a numeric
431 form of this setting is also accepted: the list is replaced by a
432 number from 0 to 3. A value of 0 turns all the warnings off, 1
433 turns on only dimensions, 2 turns on only size, and 3 turns all
434 the warnings on.
435
436 Note: A warning is always given regardless of this setting if
437 the actual argument is an array while the dummy argument is a
438 scalar variable, or if the actual argument is a scalar variable
439 or expression while the dummy argument is an array. These cases
440 are seldom intentional. (To turn off even these warnings, use
441 -arguments=no-arrayness.) No warning is ever given if the
442 actual argument is an array element while the dummy argument is
443 a scalar variable. Variable-dimensioned arrays and arrays
444 dimensioned with 1 or asterisk match any number of array ele‐
445 ments. There is no check of whether multi-dimensional arrays
446 agree in the size of each dimension separately.
447
448 See also: -arguments, -library, -usage.
449
450
451 -brief
452 Selects a shorter format for some warning messages. At present,
453 the only warnings controlled by this flag are those that are
454 printed at the end of processing each subprogram. These include
455 warnings about variables that are set but not used or used
456 before set, variable names that do not conform to the Fortran 77
457 standard, etc. (These warnings may be suppressed entirely
458 depending on other flags, such as the -usage or -f77 flags.) In
459 the default format each variable is listed on a separate line,
460 along with the line number where the variable is declared, set
461 or used, according to the nature of the warning. The briefer
462 format simply lists all variables to which the warning applies,
463 with up to 4 variables per line.
464
465 See also: -quiet.
466
467
468 -calltree=list
469 Causes ftnchek to print out the call structure of the complete
470 program.
471
472 The list consists of keywords separated by commas or colons.
473 There are two special keywords: none to turn off all the
474 options, and help to print the list of all the keywords with a
475 brief explanation of each. (The keyword all turns on all the
476 options, but should not normally be used since only one format
477 should be specified.) If list is omitted, -calltree is equiva‐
478 lent to -calltree=tree, and -nocalltree is equivalent to -call‐
479 tree=none. By default no call graph is printed.
480
481 If the -mkhtml option is invoked and tree is the applied call‐
482 tree option, a file named CallTree.html, will also be produced
483 depicting the tree in HTML format. This file is useful as a
484 starting point for browsing the HTML files describing each com‐
485 ponent of the program.
486
487 The keywords which control which format is used are as follows:
488
489 tree:
490 produce the call graph in tree format.
491
492 reference:
493 produce the call graph in who-calls-who format (same as
494 -reference switch).
495
496 vcg:
497 produce the call graph in VCG format (same as -vcg switch).
498
499 Only one of the formats tree, reference, or vcg may be speci‐
500 fied.
501
502 The following keywords control options affecting the output:
503
504 prune:
505 prune repeated subtrees (applicable only with tree). This
506 the default.
507
508 sort:
509 sort children of each routine into alphabetical order. This
510 is the default.
511
512 See the discussion of the -reference and -vcg flags for details
513 about these formats.
514
515 For tree format, The call graph is printed out starting from the
516 main program, which is listed on the first line at the left mar‐
517 gin. Then on the following lines, each routine called by the
518 main program is listed, indented a few spaces, followed by the
519 subtree starting at that routine.
520
521 In the default mode, if a routine is called by more than one
522 other routine, its call subtree is printed only the first time
523 it is encountered Later calls give only the routine name and the
524 notice ``(see above)''. To have the subtree printed for each
525 occurrence of the routine, use option no-prune.
526
527 Note that the call tree will be incomplete if any of the input
528 files are project files containing more than one module that
529 were created in -library mode. See the discussion of project
530 files below.
531
532 Technical points: Each list of routines called by a given rou‐
533 tine is printed in alphabetical order unless the no-sort option
534 is given. If multiple main programs are found, the call tree of
535 each is printed separately. If no main program is found, a
536 report to that effect is printed out, and the call trees of any
537 top-level non-library routines are printed. This flag only con‐
538 trols the printing of the call tree: ftnchek constructs the call
539 tree in any case because it is used to determine which library
540 modules will be cross-checked. See the discussion of the
541 -library flag.
542
543 For compatibility with previous versions of ftnchek, a numeric
544 form of this setting is also accepted: the list is replaced by a
545 number from 0 to 15. This number is formed from 1 for tree for‐
546 mat, 2 for reference format, or 3 for vcg format, plus 4 for
547 no-prune, and 8 for no-sort.
548
549 See also: -crossref, -library, -reference, -sort, -symtab, -vcg.
550
551
552 -check
553 This switch is provided so that errors and warning messages can
554 be turned off when ftnchek is used for purposes other than find‐
555 ing bugs, such as making declarations or printing the call tree.
556 It is positional, so after turning all checks off, selected
557 checks can be turned back on. The effect of -nocheck is to put
558 all switches, numeric settings, and settings controlling lists
559 of warnings to their turn-off values, as if they had all been
560 specified with the -no prefix. Switches and settings that spec‐
561 ify options and modes of operation, rather than controlling
562 warnings, are unaffected. These are -columns, -crossref,
563 -include, -intrinsic, -library, -list, -makedcls, -novice, -out‐
564 put, -pointersize, -project, -quiet, -reference, -resources,
565 -sort, -source, -symtab, -vcg, -version, -wordsize, and -wrap.
566 Default = yes.
567
568 Parse errors (syntax errors due to unrecognized or malformed
569 statements) are not suppressed by this switch, since the results
570 may be incorrect if ftnchek has not parsed the program cor‐
571 rectly.
572
573 There are some miscellaneous errors and warning messages that
574 are not controlled by any other switch, and so can be turned off
575 only by this switch. Note that using -check following -nocheck
576 only has the effect of turning these special warnings back on,
577 and does not restore all the checks it turned off. These warn‐
578 ings are:
579
580 o Module contains no executable statements.
581
582 o In free source form, missing space where space is required
583 (e.g. between a keyword and an identifier) or space present
584 where none is allowed (e.g. within an identifier).
585
586 o Zero or negative length specification in a data type decla‐
587 ration of the form type*len.
588
589 o Invalid operand(s) in an expression.
590
591 o Array assigned to scalar.
592
593 o Type mismatch between DO index and bounds.
594
595 o Undefined common block declared in SAVE statement.
596
597 o Intrinsic function explicitly declared with an incompatible
598 type.
599
600 o Unknown intrinsic function explicitly declared in an INTRIN‐
601 SIC statement.
602
603 o Intrinsic function passed as a subprogram argument is not
604 declared in an INTRINSIC statement.
605
606 o Intrinsic function or statement function invoked incor‐
607 rectly.
608
609 o Function does not set return value prior to RETURN state‐
610 ment.
611
612 o Parameter constant value not evaluated (this is ftnchek's
613 fault, and it is just informing you of the fact).
614
615 o Entry point of a subprogram is later used as a different
616 subprogram's name.
617
618 o Unknown keyword used in an I/O statement.
619
620 o Illegal label reference (e.g. GOTO refers to a non-exe‐
621 cutable statement; I/O statement refers to a non-format
622 statement).
623
624 See also: -errors.
625
626
627
628 -columns=num
629 Set maximum statement length to num columns. (Beyond this is
630 ignored.) This setting is provided to allow checking of pro‐
631 grams which may violate the Fortran standard limit of 72 columns
632 for the length of a statement. According to the standard, all
633 characters past column 72 are ignored. If this setting is used
634 when the -f77=long-line option is in effect, a warning will be
635 given for any lines in which characters past column 72 are pro‐
636 cessed. Turn-on = max = 132. Default = 72.
637
638 This setting does not suppress warnings about the presence of
639 characters beyond column 72. To process code with meaningful
640 program text beyond column 72, use this setting and be sure the
641 -f77 long-line option is off. To process code with sequence
642 numbers in columns 73 to 80, leave the the columns setting at
643 the default value and use the -pretty=no-long-line flag.
644
645 See also: -f77, -pretty.
646
647
648 -common=list
649 This setting controls the strictness of checking of COMMON
650 blocks. By default, all warnings except volatile are turned on.
651
652 The list consists of keywords separated by commas or colons.
653 Since most of these warnings are on by default, include a key‐
654 word prefixed by no- to turn off a particular warning. There
655 are three special keywords: all to turn on all the warnings,
656 none to turn them all off, and help to print the list of all the
657 keywords with a brief explanation of each. If list is omitted,
658 -common is equivalent to -common=dimensions,exact,length,type,
659 and -nocommon is equivalent to -common=none. The warning key‐
660 words with their meanings are as follows:
661
662 dimensions:
663 corresponding arrays in each declaration of a block must
664 agree in size and number of dimensions. This option only
665 has an effect when used together with exact.
666
667 exact:
668 the comparison of two blocks is done variable-by-variable
669 rather than simply requiring agreement between corresponding
670 storage locations. Use this if all declarations of a given
671 COMMON block are supposed to be identical, which is a good
672 programming practice.
673
674 length:
675 warn if different declarations of the same block are not
676 equal in total length. The Fortran 77 Standard requires
677 each named common block, but not blank common, to be the
678 same length in all modules of the program.
679
680 type:
681 in each declaration of a given COMMON block, corresponding
682 memory locations (words or bytes) must agree in data type.
683 If used together with exact, this will require that corre‐
684 sponding variables agree in data type.
685
686 volatile:
687 Assume that COMMON blocks are volatile.
688
689 Many Fortran programmers assume that variables, whether local or
690 in COMMON, are static, i.e. that once assigned a value, they
691 retain that value permanently until assigned a different value
692 by the program. However, in fact the Fortran 77 Standard does
693 not require this to be the case. Local variables may become
694 undefined between activations of a module in which they are
695 declared. Similarly, COMMON blocks may become undefined if no
696 module in which they are declared is active. (The technical
697 term for entities with this behavior is ``automatic'', but
698 ftnchek uses the word ``volatile'' since it is clearer to the
699 nonspecialist.) Only COMMON blocks declared in a SAVE state‐
700 ment, or declared in the main program or in a block data subpro‐
701 gram remain defined as long as the program is running. Vari‐
702 ables and COMMON blocks that can become undefined at some point
703 are called volatile.
704
705 If the -common=volatile flag is turned on, ftnchek will warn you
706 if it finds a volatile COMMON block. If, at the same time, the
707 -usage=com-block-volatile option is turned on (which is the
708 default), ftnchek will try to check whether such a block can
709 lose its defined status between activations of the modules where
710 it is declared. ftnchek does not do a very good job of this:
711 the rule used is to see whether the block is declared in two
712 separated subtrees of the call tree. For instance, this would
713 be the case if two modules, both called from the main program,
714 shared a volatile COMMON block. A block can also become unde‐
715 fined between two successive calls of the same subprogram, but
716 ftnchek is not smart enough to tell whether a subprogram can be
717 called more than once, so this case is not checked for.
718
719 The -common=volatile flag does not affect the way ftnchek checks
720 the usage of local variables.
721
722 For compatibility with previous versions of ftnchek, a numeric
723 form of this setting is also accepted: the list is replaced by a
724 number from 0 to 3. A value of 0 turns all the warnings off, 1
725 or greater turns on type, 2 or greater turns on length, and 3
726 turns on dimensions and exact also. The numeric form cannot
727 turn on the volatile option.
728
729 See also: -library, -usage.
730
731
732 -crossref=list
733 Prints cross-reference tables. Default = none.
734
735 The list consists of keywords separated by commas or colons.
736 The keywords with their meanings are as follows:
737
738 calls:
739 table lists each subprogram followed by a list of routines
740 that call it. This listing omits library modules that are
741 not in the call tree of the main program. The list is
742 alphabetized.
743
744 common:
745 table lists each COMMON block followed by a list of the
746 routines that access it. These listed routines are those
747 in which some variables in the COMMON block are accessed,
748 not simply those routines that declare the block. (To
749 find out what routines declare a COMMON block but do not
750 use it, see the -usage flag.)
751
752 labels:
753 table lists each label followed by a list of all refer‐
754 ences to it. A label reference is denoted by the line
755 number and statement type of the referring statement.
756 The label list is in sequential order. The references are
757 listed in the order they are encountered in the program.
758
759 See also: -calltree, -reference, -sort, -symtab, -vcg.
760
761
762 -declare
763 If this flag is set, all identifiers whose datatype is not
764 declared in each module will be listed. This flag is useful for
765 helping to find misspelled variable names, etc. The same list‐
766 ing will be given if the module contains an IMPLICIT NONE state‐
767 ment. Default = no.
768
769 See also: -sixchar, -usage.
770
771
772 -division
773 This switch is provided to help users spot potential division by
774 zero problems. If this switch is selected, every division
775 except by a constant will be flagged. (It is assumed that the
776 user is intelligent enough not to divide by a constant which is
777 equal to zero!) Default = no.
778
779 See also: -portability, -truncation.
780
781
782 -errors=num
783 Set the maximum number of error messages in a ``cascade''. Dur‐
784 ing checking of agreement of subprogram arguments, common block
785 declarations, and so forth, sometimes a single case will gener‐
786 ate a long string of warnings. Often this simply indicates some
787 other cause than a genuine item-by-item mismatch, such as for
788 example a varible missing from one list. So in such cases
789 ftnchek stops printing the warnings after the cascade limit is
790 reached, and the trailer ``etc...'' is printed to indicate that
791 there were more errors not printed. If you think that these
792 warnings are likely to be genuine, use this setting to see more
793 of them. Turn-on = default = 3, max = 999. A value of 0 means
794 no limit.
795
796 This setting does not set an overall limit on the number of
797 error messages printed, only the number printed in any one cas‐
798 cade. Most types of warnings and error messages are not subject
799 to the cascade effect and so are not affected by this setting.
800 To turn off warnings generally, use the individual warning con‐
801 trol options or the -nocheck option.
802
803 See also: -check.
804
805
806 -extern
807 Causes ftnchek to report whether any subprograms invoked by the
808 program are never defined. Ordinarily, if ftnchek is being run
809 on a complete program, each subprogram other than the intrinsic
810 functions should be defined somewhere. Turn off this switch if
811 you just want to check a subset of files which form part of a
812 larger complete program. Subprogram arguments will still be
813 checked for correctness. Default = yes.
814
815 The -extern flag is now superseded by the -usage=ext-undefined
816 option. For the sake of convenience, the -extern flag is
817 retained, so that -noextern is equivalent to -usage=no-ext-unde‐
818 fined option. The -extern switch may be retired eventually.
819
820 See also: -library.
821
822
823 -f77=list
824 Use this setting to catch language extensions which violate the
825 Fortran 77 Standard. Such extensions may cause your program not
826 to be portable. Examples include the use of underscores in
827 variable names; variable names longer than six characters;
828 statement lines longer than 72 characters; and nonstandard
829 statements such as the DO ... ENDDO structure. ftnchek does not
830 report on the use of lowercase letters. By default, all warn‐
831 ings are turned off.
832
833 This setting provides detailed control over the warnings about
834 supported extensions to the Fortran 77 Standard. (Further
835 details about the extensions themselves are given below in the
836 section on Extensions.) The list consists of keywords separated
837 by commas or colons. There are three special keywords: all to
838 turn on all the warnings about nonstandard extensions, none to
839 turn them all off, and help to print the list of all the key‐
840 words with a brief explanation of each. If list is omitted,
841 -f77 is equivalent to -f77=all, and -nof77 is equivalent to
842 -f77=none. The warning keywords with their meanings are as fol‐
843 lows:
844
845 accept-type:
846 ACCEPT and TYPE I/O statements.
847
848 array-bounds:
849 Expressions defining array bounds that contain array ele‐
850 ments or function references.
851
852 assignment-stmt:
853 Assignment statements involving arrays. In Fortran 90, an
854 array can be assigned to another array of compatible
855 shape, or a scalar can be assigned to an array. Neither
856 of these assignments is permitted in Fortran 77.
857
858 A related warning occurs when an array is assigned to a
859 scalar. Since this is illegal also in Fortran 90, it is
860 always warned about regardless of the -f77 setting (unless
861 all checking is turned off with the -nocheck flag).
862
863 attribute-based-decl:
864 Type declarations in the new Fortran 90 attribute-based
865 style. This style of declaration is distinguished by the
866 use of a double colon (::) between the list of attributes
867 and the list of declared variables. This option also con‐
868 trols warnings for use of Fortran 90 length or kind speci‐
869 fiers in type declarations. (Although these specifiers
870 can be used in non-attribute-based declarations, they are
871 controlled by this option to avoid proliferation of -f77
872 options.)
873
874 automatic-array:
875 Local (not dummy) arrays which have variable size. These
876 would correspond to arrays whose storage would have to be
877 dynamically allocated at run time.
878
879 backslash:
880 Unix backslash escape in strings. This warning will be
881 given only if the -source=unix-backslash setting is speci‐
882 fied to cause the escape interpretation of backslash..
883
884 byte: BYTE data type declaration.
885
886 case-construct:
887 The SELECT CASE construct.
888
889 character:
890 Extensions to the Fortran 77 standard regarding character
891 data. At present, this only controls warnings about char‐
892 acter variables declared with zero or negative length. In
893 Fortran 77, all character variables must be of positive
894 length. In Fortran 90, they can be zero length, and dec‐
895 larations that specify negative lengths are permitted,
896 turning into zero for the declared length. Note: because
897 negative length specifiers may indicate a programming
898 error, the warning about them is given even if this option
899 is turned off, and is suppressed only by the -nocheck
900 flag.
901
902 common-subprog-name:
903 Common block and subprogram having the same name.
904
905 construct-name:
906 Use of a construct-name to label a control statement.
907
908 continuation:
909 More than 19 successive continuation lines.
910
911 cpp: Unix C preprocessor directives in the source code.
912
913 cray-pointer:
914 ``Cray pointer'' syntax.
915
916 cycle-exit:
917 The CYCLE and EXIT statements.
918
919 d-comment:
920 Debugging comments starting with D in the source code.
921
922 dec-tab:
923 DEC Fortran style tab-formatted source code. This warning
924 will be given only if the -source=dec-tab setting is spec‐
925 ified to cause interpretation of tabs in this style.
926
927 do-enddo:
928 DO loop extensions: terminal statement label omitted, END
929 DO, and WHILE.
930
931 double-complex:
932 Double precision complex datatype.
933
934 format-dollarsign:
935 Dollar sign control code in FORMAT statements.
936
937 format-edit-descr:
938 Nonstandard edit descriptors in FORMAT statements.
939
940 function-noparen:
941 Function definition without parentheses.
942
943 implicit-none:
944 IMPLICIT NONE statement.
945
946 include:
947 INCLUDE statement.
948
949 inline-comment:
950 Inline comments starting with an exclamation point.
951
952 internal-list-io:
953 List-directed I/O to or from an internal file.
954
955 intrinsic:
956 Nonstandard intrinsic functions.
957
958 io-keywords
959 Nonstandard keywords used in I/O statements. These fall
960 into three groups. The first group includes keywords that
961 are accepted in Fortran 90:
962
963 ACTION PAD READWRITE
964 ADVANCE POSITION SIZE
965 DELIM READ WRITE
966 EOR
967 The second group comprises the following VMS Fortran key‐
968 words:
969
970 BLOCKSIZE EXTENDSIZE READONLY
971 BUFFERCOUNT INITIALSIZE RECORDSIZE
972 CARRIAGECONTROL MAXREC RECORDTYPE
973 DEFAULTFILE NAME (in OPEN) SHARED
974 DISP NOSPANBLOCK TYPE
975 DISPOSE ORGANIZATION
976 (The keyword NAME is standard only in the INQUIRE state‐
977 ment.) The third group consists of the following IBM/MVS
978 keyword:
979
980 NUM
981 This flag also controls a warning about use of
982 ACCESS='APPEND', which is accepted by some compilers. The
983 value of 'APPEND' is not valid for any I/O specifier in
984 standard Fortran 77, and in Fortran 90 'APPEND' should be
985 used as a value of the POSITION specifier, not ACCESS.
986
987 long-line:
988 Statements with meaningful code past 72 columns. This
989 warning is given only if the -columns setting has been
990 used to increase the statement field width.
991
992 long-name:
993 Identifiers over 6 characters long.
994
995 mixed-common:
996 Mixed character and noncharacter data in COMMON block.
997
998 mixed-expr:
999 Nonstandard type combinations in expressions, for example
1000 DOUBLE PRECISION with COMPLEX, assigning hollerith to
1001 integer, logical operations on integers.
1002
1003 name-dollarsign:
1004 Dollar sign used as a character in identifiers.
1005
1006 name-underscore:
1007 Underscore used as a character in identifiers.
1008
1009 namelist:
1010 NAMELIST statement.
1011
1012 param-implicit-type:
1013 Implicit typing of a parameter by the data type of the
1014 value assigned. This warning can only occur if implicit
1015 parameter typing has been turned on by the
1016 -source=param-implicit-type option, or if the PARAMETER
1017 statement is of the nonstandard form without parentheses.
1018 If this option is turned on, then any instances where
1019 implicit parameter typing occurs will be warned about. If
1020 you want to be warned only in those instances where the
1021 implicit data type differs from the default type, use
1022 -portability=param-implicit-type instead. According to
1023 the Fortran 77 standard, the data type of a parameter is
1024 given by the same rules as for a variable, and if neces‐
1025 sary a type conversion is done when the value is assigned.
1026
1027 param-intrinsic:
1028 Intrinsic function or exponentiation by a real used to
1029 define the value of a PARAMETER definition.
1030
1031 param-noparen:
1032 PARAMETER statement without parentheses. The user should
1033 be aware that the semantics of this form of the statement
1034 differs from that of the standard form: in this form, the
1035 parameter takes its data type from the value assigned,
1036 rather than having its default data type based on the
1037 first letter of the parameter name. (This form of the
1038 PARAMETER statement was introduced by DEC before the For‐
1039 tran 77 standard was defined, and should be avoided.)
1040
1041 pointer:
1042 Fortran 90 standard pointer-related syntax, including
1043 POINTER, TARGET and ALLOCATABLE type declarations, ALLO‐
1044 CATE, DEALLOCATE, and NULLIFY statements, and pointer
1045 assignment using =>.
1046
1047 quad-constant:
1048 Quad precision real constants, e.g. of the form 1.23Q4.
1049
1050 quotemark:
1051 Strings delimited by quote marks rather than apostrophes.
1052
1053 relops:
1054 Relational (comparison) operators composed of punctuation,
1055 namely: < <= == /= > >=.
1056
1057 semicolon:
1058 Semicolon used as statement separator.
1059
1060 statement-order:
1061 Statements out of the sequence mandated by the Standard.
1062 The allowed sequence is illustrated in Table 1 in the sec‐
1063 tion on Interpreting the Output.
1064
1065 typeless-constant:
1066 Typeless constants, for example Z'19AF'.
1067
1068 type-size:
1069 Type declarations specifying a size, for example REAL*8.
1070
1071 variable-format:
1072 Variable repeat specification or field size in FORMAT.
1073 These are of the form < expr >.
1074
1075 vms-io:
1076 Obsolete. Now has the same meaning as the io-keywords
1077 keyword.
1078
1079 See also: -f90, -f95, -portability, -pretty, -style, -wordsize.
1080
1081
1082 -f90=list
1083 This setting provides detailed control over the warnings about
1084 supported extensions to the Fortran 77 Standard that were not
1085 adopted as part of the Fortran 90 Standard. Note that ftnchek
1086 does not support the full Fortran 90 language. However, it does
1087 support some common extensions to Fortran 77 that were prevalent
1088 before Fortran 90 was defined. Some of these extensions became
1089 part of the Fortran 90 Standard, but others did not. The -f90
1090 setting warns only about the latter. That is, this flag covers
1091 things that are neither legal Fortran 77 nor legal Fortran 90.
1092 Therefore, the warnings controlled by this flag are basically a
1093 subset of the warnings controlled by -f77. There are a few
1094 cases, described below, where the circumstances in which the
1095 warning is given are slightly different for the two flags.
1096
1097 The list consists of keywords separated by commas or colons.
1098 There are three special keywords: all to turn on all the warn‐
1099 ings about nonstandard extensions, none to turn them all off,
1100 and help to print the list of all the keywords with a brief
1101 explanation of each. If list is omitted, -f90 is equivalent to
1102 -f90=all, and -nof90 is equivalent to -f90=none.
1103
1104 The following keywords have identical meanings for -f90 as for
1105 -f77. The reader is referred to the explanations under -f77.
1106
1107 accept-type double-complex param-noparen
1108 backslash format-dollarsign cray-pointer
1109 byte format-edit-descr quad-constant
1110 cpp function-noparen type-size
1111 d-comment name-dollarsign variable-format
1112 dec-tab param-implicit-type vms-io
1113
1114 The keywords which differ somewhat from the corresponding -f77
1115 keywords are as follows.
1116
1117 continuation:
1118 The limit on the number of continuation lines for a state‐
1119 ment in fixed source form is the same, namely 19, in For‐
1120 tran 90 as in Fortran 77. For free source form the limit
1121 is 39 continuation lines, and a line containing a continu‐
1122 ation mark cannot be otherwise empty or contain only a
1123 comment.
1124
1125 intrinsic:
1126 This is the same as for -f77 except for the intrinsic
1127 functions defined in MIL-STD 1753, which are all included
1128 in Fortran 90, and so are not warned about. (See -intrin‐
1129 sic for a list.)
1130
1131 io-keywords:
1132 This is the same as for -f77 except that no warnings are
1133 given for the I/O keywords that are standard in Fortran
1134 90.
1135
1136 long-line:
1137 Although the Fortran 90 Standard allows lines longer than
1138 72 characters in free source form, this restriction still
1139 applies to fixed source form. In free source form the
1140 line length limit is 132 characters, and unlike fixed
1141 form, ftnchek does not allow this limit to be increased.
1142
1143 mixed-expr:
1144 This is the same as for -f77 except for expressions mixing
1145 extended precision real with complex data types, which are
1146 permitted in Fortran 90.
1147
1148 statement-order:
1149 This is similar to the corresponding -f77 warning, but
1150 applies the somewhat looser restrictions on statement
1151 order of the Fortran 90 Standard. In particular, Fortran
1152 90 allows DATA statements and statement-function defini‐
1153 tions to be intermixed with specification statements.
1154
1155 typeless-constant:
1156 In Fortran 90, binary, octal, and hexadecimal constants of
1157 the form B'ddd', O'ddd', and Z'ddd', respectively, are
1158 permitted. Here 'ddd' represents a string of digits.
1159 ftnchek recognizes these forms, as well as a variant of
1160 the form X'ddd' for a hexadecimal constant, and other
1161 variants in which the base indicator B, O, Z, or X follows
1162 the digit string. These variants were not adopted in For‐
1163 tran 90, so only they are warned about when this flag is
1164 turned on.
1165
1166 See also: -f77, -f95, -portability, -pretty, -style, -wordsize.
1167
1168
1169 -f95=list
1170 This setting provides detailed control over warnings about stan‐
1171 dard Fortran 77 features that were deleted from the Fortran 95
1172 Standard. Unlike the -f77 and -f90 settings, these warnings
1173 apply to syntax which is legal Fortran 77. However, since these
1174 features have been deleted from the Standard, it is possible
1175 that programs containing them will be unacceptable to some newer
1176 compilers.
1177
1178 The list consists of keywords separated by commas or colons.
1179 There are three special keywords: all to turn on all the warn‐
1180 ings about nonstandard extensions, none to turn them all off,
1181 and help to print the list of all the keywords with a brief
1182 explanation of each. If list is omitted, -f95 is equivalent to
1183 -f95=all, and -nof95 is equivalent to -f95=none. The warning
1184 keywords with their meanings are as follows.
1185
1186 real-do:
1187 A DO variable of any real numeric type.
1188
1189 pause:
1190 The PAUSE statement.
1191
1192 assign:
1193 The ASSIGN statement, assigned GOTO, or assigned format.
1194
1195 h-edit:
1196 The H edit descriptor in a format.
1197
1198 There is one other Fortran 77 syntax feature that was deleted in
1199 Fortran 95, namely branching to an ENDIF from outside the IF
1200 block. However, ftnchek is unable to analyze program flow, and
1201 so it does not provide a warning for this.
1202
1203 See also: -f77, -f90, -portability, -pretty, -style, -wordsize.
1204
1205
1206 -help
1207 Prints a list of all the command-line options with a short
1208 description of each along with its default value. This command
1209 is identical in function to the ``?'' argument, and is provided
1210 as a convenience for those systems in which the question mark
1211 has special meaning to the command interpreter. Default = no.
1212
1213 The help listing also prints the version number and patch level
1214 of ftnchek and a copyright notice.
1215
1216 Note: the ``default'' values printed in square brackets in the
1217 help listing are, strictly speaking, not the built-in defaults
1218 but the current values after any environment options and any
1219 command-line options preceding the -help option have been pro‐
1220 cessed.
1221
1222 See also: -novice, -version, and help option of all settings
1223 that take a list of keywords.
1224
1225
1226 -identifier-chars=list
1227 Define non-alphanumeric characters that may be used in identi‐
1228 fiers. By default, ftnchek only accepts the dollar sign and
1229 underscore as non-alphanumeric characters in identifier names.
1230 The characters in the list replace whatever set of accepted non-
1231 alphanumeric characters was previously in effect. Thus, if dol‐
1232 lar sign or underscore are not included in the list, they lose
1233 their status as acceptable characters.
1234
1235 This option is provided to enable ftnchek to handle source files
1236 containing non-standard identifer names that may be needed, for
1237 example, to access certain operating system services. See the
1238 section on Limitations and Extensions for the treatment of iden‐
1239 tifiers containing these characters in implicit typing.
1240
1241 Using -noidentifer-chars turns off acceptance of non-alphanu‐
1242 meric characters entirely.
1243
1244 See also: -source.
1245
1246
1247 -include=path
1248 Specifies a directory to be searched for files specified by
1249 INCLUDE statements. Unlike other command-line options, this
1250 setting is cumulative; that is, if it is given more than once on
1251 the command line, all the directories so specified are placed on
1252 a list that will be searched in the same order as they are
1253 given. The order in which ftnchek searches for a file to be
1254 included is: the current directory; the directory specified by
1255 environment variable FTNCHEK_INCLUDE if any; the directories
1256 specified by any -include options; the directory specified by
1257 environment variable INCLUDE; and finally in a standard system-
1258 wide directory (/usr/include for UNIX, SYS$LIBRARY for VMS, and
1259 \include for MSDOS).
1260
1261 See also: -f77, -source.
1262
1263
1264 -intrinsic=list
1265 Controls whether ftnchek recognizes certain nonstandard intrin‐
1266 sic functions as intrinsic. The list consists of keywords sepa‐
1267 rated by commas or colons. Some of the keywords control whether
1268 to recognize certain groups of functions, and other keywords
1269 control the expected syntax for invoking some nonstandard
1270 intrinsics. Include a keyword to turn on recognition of the
1271 corresponding set of intrinsics or to allow the corresponding
1272 syntax. Include a keyword prefixed by no- to turn off that
1273 recognition.
1274
1275 There are three special keywords: all turns on recognition of
1276 all the nonstandard intrinsics (listed below) and accepts either
1277 syntax for those that have variations. Use none to turn off
1278 recognition of all nonstandard intrinsics except those noted
1279 below. Use help to print the list of all the keywords with a
1280 brief explanation of each. If list is omitted, -intrinsic is
1281 equivalent to -intrinsic=all, and -nointrinsic is equivalent to
1282 -intrinsic=none.
1283
1284 The nonstandard intrinsic functions needed to support the non‐
1285 standard extended precision data types (double complex and quad
1286 precision) are always recognized. The intrinsics for the double
1287 complex data type are:
1288
1289 CDABS CDSQRT DREAL ZLOG
1290 CDCOS DCMPLX IMAG ZSIN
1291 CDEXP DCONJG ZABS ZSQRT
1292 CDLOG DIMAG ZEXP ZCOS
1293 CDSIN
1294 The intrinsics for the quad precision and quad complex types
1295 are:
1296
1297 CQABS QARCOS QEXT QNINT
1298 CQCOS QARSIN QEXTD QPROD
1299 CQEXP QATAN QFLOAT QREAL
1300 CQLOG QATAN2 QIMAG QSIGN
1301 CQSIN QCMPLX QINT QSIN
1302 CQSQRT QCONJG QLOG QSINH
1303 DBLEQ QCOS QLOG10 QSQRT
1304 IQINT QCOSH QMAX1 QTAN
1305 IQNINT QDIM QMIN1 QTANH
1306 QABS QEXP QMOD SNGLQ
1307 The keywords controlling recognition of other nonstandard
1308 intrinsic functions are as follows:
1309
1310 extra:
1311 recognize the following commonly available nonstandard
1312 intrinsics (all except EXIT and LOC are defined in MIL-STD
1313 1753):
1314
1315 BTEST IBCLR IEOR ISHFTC
1316 EXIT IBITS IOR LOC
1317 IAND IBSET ISHFT NOT
1318
1319
1320 unix: recognize these common Unix-specific intrinsic functions:
1321
1322 ABORT GMTIME LTIME SRAND
1323 AND IARGC OR SYSTEM
1324 GETARG IRAND RAND TIME
1325 GETENV LSHIFT RSHIFT XOR
1326
1327
1328 vms: recognize these common VMS-specific intrinsic functions:
1329
1330 DATE IDATE SECNDS TIME
1331 ERRSNS RAN SIZEOF
1332
1333
1334 iargc-no-argument:
1335 specify that IARGC may be invoked with no arguments.
1336
1337 iargc-one-argument:
1338 specify that IARGC may be invoked with one argument.
1339
1340 rand-no-argument:
1341 specify that RAND and IRAND may be invoked with no argu‐
1342 ments.
1343
1344 rand-one-argument:
1345 specify that RAND and IRAND may be invoked with one argu‐
1346 ment.
1347
1348 The no-argument and one-argument keywords work as follows: turn‐
1349 ing the option on causes ftnchek to accept the corresponding
1350 syntax for invocation of the function, without excluding the
1351 possibility of the alternative syntax. Turning the option off
1352 causes the corresponding syntax not to be accepted. If both
1353 options are turned on at once (the default), then either syntax
1354 is accepted. Turning both options off at once would not be
1355 meaningful. These options have no effect if recognition of Unix
1356 intrinsics has been turned off.
1357
1358 Note that this setting does not control whether non-standard
1359 warnings are issued about these functions. It controls whether
1360 the functions are assumed to be intrinsic or not, which deter‐
1361 mines how their usage is checked. When functions in any of
1362 these sets are included, their invocations will be checked
1363 according to the rules for the intrinsic functions; otherwise
1364 they will be checked as normal (user-written) external func‐
1365 tions. The non-standard warnings are controlled by the
1366 -f77=intrinsic option.
1367
1368 The default value of this setting is equivalent to -intrin‐
1369 sic=all followed by -intrinsic=no-vms for the Unix version,
1370 -intrinsic=no-unix for the VMS version, and -intrin‐
1371 sic=no-unix,no-vms for other versions.
1372
1373 Note: In versions of ftnchek prior to 2.10, the -intrinsic flag
1374 took a numeric argument instead of a list of options. For the
1375 sake of users who may have written scripts invoking ftnchek in
1376 this way, the numeric form is still accepted. The numeric form
1377 of the setting consists of three digits. The ones digit selects
1378 the set of intrinsic functions to be supported. The digit 0
1379 selects only Fortran 77 standard intrinsics plus those needed to
1380 support the nonstandard extended precision data types. The
1381 digit 1 is equivalent to extra, 2 is equivalent to extra,unix,
1382 and 3 is equivalent to extra,vms. The tens digit of this set‐
1383 ting controls the syntax of the RAND intrinsic function, and the
1384 hundreds digit controls the syntax of the IARGC function. For
1385 these digits, specify 0 to require invocation with no argument,
1386 1 to require one argument, and 2 to allow either form.
1387
1388 See also: -f77.
1389
1390
1391 -library
1392 This switch is used when a number of subprograms are contained
1393 in a file, but not all of them are used by the application.
1394 Normally, ftnchek warns you if any subprograms are defined but
1395 never used. This switch will suppress these warnings. Default
1396 = no.
1397
1398 This switch also controls which subprogram calls and COMMON
1399 block declarations are checked. If a file is read with the
1400 -library flag in effect, the subprogram calls and COMMON decla‐
1401 rations contained in a routine in that file will be checked only
1402 if that routine is in the main program's call tree. On the
1403 other hand, if the -library switch is turned off, then ftnchek
1404 checks the calls of every routine by every other routine,
1405 regardless of whether those routines could ever actually be
1406 invoked at run time, and likewise all COMMON block declarations
1407 are compared for agreement.
1408
1409 The difference between this switch and the -usage=no-ext-unused
1410 option for subprograms is that the latter suppresses only the
1411 warning about routines being declared but not used. The
1412 -library switch goes further and excludes unused routines pro‐
1413 cessed while it is in effect from all cross-checking of argu‐
1414 ments and COMMON block declarations as well.
1415
1416 (If there is no main program anywhere in the set of files that
1417 ftnchek has read, so that there is no call tree, then ftnchek
1418 will look for any non-library routines that are not called by
1419 any other routine, and use these as substitutes for the main
1420 program in constructing the call tree and deciding what to
1421 check. If no such top-level non-library routines are found,
1422 then all inter-module calls and all COMMON declarations will be
1423 checked.)
1424
1425 See also: -arguments, -calltree, -common, -extern, -usage.
1426
1427
1428 -list
1429 Specifies that a listing of the Fortran program is to be printed
1430 out with line numbers. If ftnchek detects an error, the error
1431 message follows the program line with a caret ( ^ ) specifying
1432 the location of the error. If no source listing was requested,
1433 ftnchek will still print out any line containing an error, to
1434 aid the user in determining where the error occurred. Default =
1435 no.
1436
1437 See also: -output, \fB-symtab, fB-quiet.
1438
1439
1440 -makedcls=list
1441 Prepare a neatly-formatted file of declarations of variables,
1442 common blocks, and namelist lists, for possible merging into the
1443 source code. The declarations are stored in a file of the same
1444 name as the source code, but with the extension changed to .dcl.
1445 If no declarations are written to the file, it is deleted to
1446 reduce clutter from empty files.
1447
1448 If input comes from standard input, instead of a named file,
1449 then declarations are written to standard output.
1450
1451 Variables are declared in alphabetical order within each decla‐
1452 ration class and type, with integer variables first, because of
1453 their later possible use in array dimensions.
1454
1455 PARAMETER statements are an exception to the alphabetical order
1456 rule, because the Fortran 77 Standard requires that the expres‐
1457 sions defining parameter values refer only to constants and
1458 already-defined parameter names. This forces the original
1459 source file order of such statements to be preserved in the dec‐
1460 laration files.
1461
1462 Explicit declaration of all variables is considered good modern
1463 programming practice. By using compiler options to reject unde‐
1464 clared variables, misspelled variable names (or names extending
1465 past column 72) can be caught at compile time. Explicit decla‐
1466 rations also greatly facilitate changing floating-point preci‐
1467 sion with filters such as dtoq(1L), dtos(1L), fd2s(1L),
1468 fs2d(1L), qtod(1L), and stod(1L). These programs are capable of
1469 changing types of explicit floating-point type declarations,
1470 intrinsic functions, and constants, but because they do not
1471 carry out rigorous lexical and grammatical analysis of the For‐
1472 tran source code, they cannot provide modified type declarations
1473 for undeclared variables. Default setting = 0, turn-on = 1.
1474
1475 Various options for the form of the declarations file are con‐
1476 trolled by the list, which consists of keywords separated by
1477 commas or colons. There are three special keywords: all to turn
1478 on all the options, none to turn them all off, and help to print
1479 the list of all the keywords with a brief explanation of each.
1480 If list is omitted, -makedcls is equivalent to -makedcls=decla‐
1481 rations (i.e. produce the declarations file using the default
1482 options), and -nomakedcls is equivalent to -makedcls=none.
1483
1484 For compatibility with previous versions of ftnchek, a numeric
1485 form of this setting is also accepted: the list is replaced by
1486 a number which is the sum of the numbers in parentheses beside
1487 the keywords in the following list. The warning keywords with
1488 their meanings are as follows:
1489
1490 declarations (1):
1491 Write a declaration file. (This is implied by any of the
1492 other options, and can be omitted if any other options are
1493 given.)
1494
1495 undeclared-only (2):
1496 By default, all variables are included in the declaration
1497 file. With this option, include only undeclared vari‐
1498 ables. This setting is useful if you want to check for
1499 undeclared variables, since Fortran source files with all
1500 variables properly declared will not result in a .dcl
1501 file. With this option, common blocks and namelist lists
1502 will not be included in the declaration file, since by
1503 their nature they cannot be undeclared.
1504
1505 compact (4):
1506 The declarations are normally prettyprinted to line up
1507 neatly in common columns, as in the declaration files out‐
1508 put by the Extended PFORT Verifier, pfort(1L). This
1509 option value selects instead compact output, without col‐
1510 umn alignment.
1511
1512 use-continuation-lines (8):
1513 Causes continuation lines to be used where permissible.
1514 The default is to begin a new declaration on each line.
1515 This option is appropriate to use together with compact.
1516
1517 keywords-lowercase (16):
1518 Output Fortran keywords in lowercase, instead of the
1519 default uppercase.
1520
1521 vars-and-consts-lowercase (32):
1522 Output variables and constants in lowercase, instead of
1523 the default uppercase. Character string constants are
1524 not affected by this option.
1525
1526 exclude-sftran3 (64):
1527 Omit declarations of internal integer variables produced
1528 by the SFTRAN3 preprocessor, xsf3(1L), as part of the
1529 translation of structured Fortran statements to ordinary
1530 Fortran. These variables have six-character names of the
1531 form NPRddd, NXdddd, N2dddd, and N3dddd, where d is a dec‐
1532 imal digit. Because they are invisible in the SFTRAN3
1533 source code, and will change if the SFTRAN3 code is modi‐
1534 fied, such variables should not be explicitly declared.
1535 Instead, they should just assume the default Fortran INTE‐
1536 GER data type based on their initial letter, N.
1537
1538 asterisk-comment (128):
1539 Use an asterisk as the comment character; the default is
1540 otherwise 'C'.
1541
1542 comment-char-lowercase (256):
1543 Use 'c' instead of 'C' or '*' as the comment character.
1544
1545 suppress-array-dimensions (512):
1546 Suppress dimensioning of arrays in the generated declara‐
1547 tions. This option is for use with code lacking type dec‐
1548 larations, to allow the declaration files to be inserted
1549 without change into the code. Since the code will have
1550 dimension statements already, dimensioning the array vari‐
1551 ables in the type statements of the declaration file is
1552 redundant. This option should be used only in conjunction
1553 with option 2 = undeclared-only because otherwise any
1554 arrays that were dimensioned in a type statement will lose
1555 their dimensioning.
1556
1557 free-form (1024):
1558 Produce declarations in free source form. This mode is
1559 automatically used if the input source is free form. Use
1560 this option to produce declarations in free form even if
1561 the input is in fixed form. Free form declarations are
1562 indented only 2 columns instead of 6, use the exclamation
1563 mark as the comment character, and indicate continuation
1564 lines by an ampersand at the end of the line to be contin‐
1565 ued.
1566
1567 The declaration files contain distinctive comments that mark the
1568 start and end of declarations for each program unit, to facili‐
1569 tate using text editor macros for merging the declarations back
1570 into the source code.
1571
1572 The ftnchek distribution includes a program, dcl2inc, which pro‐
1573 cesses declaration files to produce files containing declara‐
1574 tions of all COMMON blocks, in a form suitable for use as
1575 INCLUDE files. See the dcl2inc(1L) man page for the details of
1576 its use.
1577
1578 See also: -mkhtml.
1579
1580
1581 -mkhtml=list
1582 Produce HTML documentation from source. Creates individual HTML
1583 files from ftnchek analysis and code comments. All comments
1584 immediately preceding and following the function or subroutine
1585 definition are captured to the HTML file. No reformatting of
1586 source comments is performed other than stripping of FORTRAN
1587 comment characters. In addition, the HTML file lists the local
1588 variables declared, common block variables used, functions and
1589 subroutines called, I/O unit usage, and other information about
1590 each subprogram. Usually you will also want to specify
1591 -call=tree to create the root HTML file CallTree.html. (Perhaps
1592 this file should be named index.html.)
1593
1594 Various options for the form of the HTML files are controlled by
1595 the list, which consists of keywords separated by commas or
1596 colons. There are three special keywords: all to turn on all
1597 the options, none to turn them all off, and help to print the
1598 list of all the keywords with a brief explanation of each. If
1599 list is omitted, -mkhtml is equivalent to -mkhtml=documents
1600 (i.e. produce the HTML document files using the default
1601 options), and -nomkhtmls is equivalent to -mkhtml=none.
1602
1603 For the sake of simplicity, the options for -mkhtml are the same
1604 as those for -makedcls except for those that are inapplicable.
1605 Likewise, a numeric form of this setting can be used, formed as
1606 the sum of the numbers in parentheses in the list below. The
1607 warning keywords with their meanings are as follows:
1608
1609 documents (1):
1610 Create the HTML documents. (This is implied by any of the
1611 other options, and can be omitted if any other options are
1612 given.)
1613
1614 compact (4):
1615 The declarations are normally prettyprinted to line up
1616 neatly in common columns. This option value selects
1617 instead compact output, without column alignment.
1618
1619 use-continuation-lines (8):
1620 Causes continuation lines to be used instead of beginning
1621 a new declaration on each line. This option is appropri‐
1622 ate to use together with compact.
1623
1624 keywords-lowercase (16):
1625 Output Fortran keywords in lowercase, instead of the
1626 default uppercase.
1627
1628 vars-and-consts-lowercase (32):
1629 Output variables and constants in lowercase, instead of
1630 the default uppercase. Character string constants are
1631 not affected by this option.
1632
1633 exclude-sftran3 (64):
1634 Omit declarations of internal integer variables produced
1635 by the SFTRAN3 preprocessor, xsf3(1L). (See -makedcls for
1636 discussion.)
1637
1638 suppress-array-dimensions (512):
1639 Suppress dimensioning of arrays in the generated declara‐
1640 tions. This is normally undesirable, but is available if
1641 for some reason you do not want the array dimensions to
1642 appear in the HTML.
1643
1644 free-form (1024):
1645 Produce variable declarations in free source form. This
1646 mode is automatically used if the input source is free
1647 form. This mainly affects the form of continuation lines
1648 if they are used.
1649
1650 See also: -calltree, -makedcls.
1651
1652
1653 -novice
1654 This flag is intended to provide more helpful output for begin‐
1655 ners. It has two effects:
1656
1657 (a) provides an extra message to the effect that a function that
1658 is used but not defined anywhere might be an array which the
1659 user forgot to declare in a DIMENSION statement (since the
1660 syntax of an array reference is the same as that of a func‐
1661 tion reference).
1662
1663 (b) modifies the form of the error messages and warnings. If
1664 the flag is turned off by -nonovice, these messages are
1665 printed in a style more resembling UNIX lint.
1666
1667 Default = yes.
1668
1669
1670 -output=filename
1671 This setting is provided for convenience on systems which do not
1672 allow easy redirection of output from programs. When this set‐
1673 ting is given, the output which normally appears on the screen
1674 will be sent instead to the named file. Note, however, that
1675 operational errors of ftnchek itself (e.g. out of space or can‐
1676 not open file) will still be sent to the screen. The extension
1677 for the filename is optional, and if no extension is given, the
1678 extension .lis will be used.
1679
1680
1681 -pointersize=num
1682 Specifies the size of a ``Cray pointer'' variable to be num
1683 bytes. Default = turn-on = 4 bytes.
1684
1685 The pointer size is used to inform precision mismatch warnings
1686 involving pointer variables, for example when a pointer is
1687 assigned a value from an allocation routine, or passed as a sub‐
1688 program parameter.
1689
1690 See also: -f77, -portability, -truncation, -wordsize.
1691
1692
1693 -portability=list
1694 ftnchek will give warnings for a variety of non-portable usages.
1695 Examples include the use of tabs except in comments or inside
1696 strings, the use of Hollerith constants, and the equivalencing
1697 of variables of different data types. This option does not pro‐
1698 duce warnings for supported extensions to the Fortran 77 Stan‐
1699 dard, which may also cause portability problems. To catch
1700 those, use the -f77 setting. By default, all warnings are
1701 turned off.
1702
1703 This setting provides detailed control over the warnings about
1704 possible portability problems. The list consists of keywords
1705 separated by commas or colons. There are three special key‐
1706 words: all to turn on all the warnings about nonportable usages,
1707 none to turn them all off, and help to print the list of all the
1708 keywords with a brief explanation of each. If list is omitted,
1709 -portability is equivalent to -portability=all, and -noportabil‐
1710 ity is equivalent to -portability=none. The warning keywords
1711 with their meanings are as follows:
1712
1713 backslash:
1714 Backslash character in strings. Since some compilers
1715 treat the backslash as an escape character, its presence
1716 can cause problems even though it is used in a standard-
1717 conforming way.
1718
1719 common-alignment:
1720 COMMON block variables not in descending order of storage
1721 size. Some compilers require this ordering because of
1722 storage alignment requirements.
1723
1724 hollerith:
1725 Hollerith constants (other than within FORMAT specifica‐
1726 tions). The Hollerith data type is a feature of Fortran
1727 IV that has been deleted in the Fortran 77 standard. It
1728 is superseded by the character data type. Storing Hol‐
1729 lerith data in variables of a numeric or logical data type
1730 is nonportable due to differing word sizes.
1731
1732 long-string:
1733 String constants, variables, or expressions over 255 chars
1734 long.
1735
1736 mixed-equivalence:
1737 Variables of different data types equivalenced.
1738
1739 mixed-size:
1740 Variables declared with default precision used with vari‐
1741 ables given explicit precision, in expressions, assign‐
1742 ments, or as arguments. For example, if a variable
1743 declared as REAL*8 is treated as equivalent to DOUBLE PRE‐
1744 CISION.
1745
1746 real-do:
1747 Non-integer DO loop index and bounds. These can cause a
1748 program's results to depend on the hardware characteris‐
1749 tics of the particular computer used.
1750
1751 param-implicit-type:
1752 Implicit typing of a parameter by the data type of the
1753 value assigned, if it differs from the default type. This
1754 warning can only occur if implicit parameter typing has
1755 been turned on by the -source=param-implicit-type option,
1756 or if the PARAMETER statement is of the nonstandard form
1757 without parentheses. If this option is turned on, then
1758 any instances where implicit parameter typing occurs and
1759 where the implicit type is different from the default type
1760 based on the first letter of the parameter name, will be
1761 warned about. Implicit parameter typing can change the
1762 semantics of statements where the parameter is used, caus‐
1763 ing portability problems.
1764
1765 tab: Tabs in source code. Tabs are interpreted differently by
1766 different compilers. This warning will be given only
1767 once, at the end of the file.
1768
1769 See also: -f77, -f90, -f95, -pretty, -style, -wordsize.
1770
1771
1772 -pretty=list
1773 Controls certain messages related to the appearance of the
1774 source code. These warn about things that might make a program
1775 less readable or be deceptive to the reader. By default, all
1776 warnings are turned on.
1777
1778 This setting provides detailed control over the warnings about
1779 appearance. The list consists of keywords separated by commas
1780 or colons. Since all warnings are on by default, include a key‐
1781 word prefixed by no- to turn off a particular warning. There
1782 are three special keywords: all to turn on all the warnings
1783 about misleading appearances, none to turn them all off, and
1784 help to print the list of all the keywords with a brief explana‐
1785 tion of each. If list is omitted, -pretty is equivalent to
1786 -pretty=all, and -nopretty is equivalent to -pretty=none. The
1787 warning keywords with their meanings are as follows:
1788
1789 alternate-return:
1790 A RETURN statement has a constant specifying an alternate
1791 return point that is not between 0 and the number of dummy
1792 arguments that are labels. This is legal, and has the
1793 same effect as a RETURN with no alternate return expres‐
1794 sion, but suggests that the programmer intended to use an
1795 alternate return label that is not provided.
1796
1797 embedded-space:
1798 Space embedded in variable names or in multi-character
1799 operators such as **.
1800
1801 continuation:
1802 Continuation mark following a comment line.
1803
1804 long-line:
1805 Lines (except comments) over 72 columns in width (beyond
1806 72 is normally ignored by compiler).
1807
1808 missing-space:
1809 Lack of space between variable and a preceding keyword.
1810
1811 multiple-common:
1812 COMMON block declared in multiple statements. No warning
1813 is given if the statements are consecutive except for com‐
1814 ment lines.
1815
1816 multiple-namelist:
1817 NAMELIST declared in multiple statements. No warning is
1818 given if the statements are consecutive except for comment
1819 lines.
1820
1821 parentheses:
1822 Parentheses around a variable by itself. As a subprogram
1823 argument, this makes the argument an expression, not modi‐
1824 fiable by the subprogram.
1825
1826 Note that in free source form, extra space and missing space are
1827 forbidden by the Fortran 90 Standard, and are not mere style
1828 violations. In this case the warnings are replaced by syntax
1829 error messages, and can be turned off only by using -nocheck.
1830
1831 See also: -f77, -portability, -style.
1832
1833
1834 -project=list
1835 ftnchek will create a project file from each source file that is
1836 input while this option is turned on. The project file will be
1837 given the same name as the input file, but with the extension .f
1838 or .for replaced by .prj. (If input is from standard input, the
1839 project file is named ftnchek.prj.) Default = none.
1840
1841 The list consists of keywords separated by commas or colons.
1842 There are three special keywords: all to turn on all the
1843 options, none to turn them all off, and help to print the list
1844 of all the keywords with a brief explanation of each. If list
1845 is omitted, -project is equivalent to -project=all, and -nopro‐
1846 ject is equivalent to -project=none. The keywords with their
1847 meanings are as follows:
1848
1849 create:
1850 Produce a project file. The default is not to produce a
1851 project file. If this option is not turned on, the other
1852 options have no effect.
1853
1854 trim-calls:
1855 Trim the amount of information stored in the project file
1856 about subprogram declarations and calls. This is the
1857 default. Turn this option off only in rare situations.
1858 (See discussion below.) The amount of trimming varies
1859 depending on the -library flag. More information is
1860 trimmed if that flag is turned on.
1861
1862 trim-common:
1863 Trim the number of common block declarations stored in the
1864 project file. This is the default. Turn this option off
1865 only in rare situations. (See discussion below.) This
1866 option has no effect if the -library flag is turned off:
1867 when not in library mode, no trimming of common block dec‐
1868 larations is done regardless of this option.
1869
1870 A project file contains a summary of information from the source
1871 file, for use in checking agreement among FUNCTION, SUBROUTINE,
1872 and COMMON usages in other files. It allows incremental check‐
1873 ing, which saves time whenever you have a large set of files
1874 containing shared subroutines, most of which seldom change. You
1875 can run ftnchek once on each file with the -project flag set,
1876 creating the project files. Usually you would also set the
1877 -library and -noextern flags at this time, to suppress messages
1878 relating to consistency with other files. Only error messages
1879 pertaining to each file by itself will be printed at this time.
1880 Thereafter, run ftnchek without these flags on all the project
1881 files together, to check consistency among the different files.
1882 All messages internal to the individual files will now be omit‐
1883 ted. Only when a file is altered will a new project file need
1884 to be made for it.
1885
1886 Naturally, when the -project option is turned on, ftnchek will
1887 not read project files as input.
1888
1889 Ordinarily, the trim options should be left on when you intend
1890 to create project files for future input to ftnchek. Since
1891 trimming is on by default, this means that simply giving the
1892 command -project with no option list is the recommended mode.
1893 The trim options are provided only as a convenience for those
1894 who want to make use of project files for purposes other than
1895 checking the program with ftnchek. To use project files for
1896 their intended purpose, the trim options should not be turned
1897 off.
1898
1899 Project files contain only information needed for checking
1900 agreement between files. This means that a project file is of
1901 no use if all modules of the complete program are contained in a
1902 single file.
1903
1904 A more detailed discussion is given in the section on Using
1905 Project Files.
1906
1907
1908 -pure
1909 Assume functions are ``pure'', i.e., they will not have side
1910 effects by modifying their arguments or variables in a COMMON
1911 block. When this flag is in effect, ftnchek will base its
1912 determination of set and used status of the actual arguments on
1913 the assumption that arguments passed to a function are not
1914 altered. It will also issue a warning if a function is found to
1915 modify any of its arguments or any COMMON variables. Default =
1916 yes.
1917
1918 When this flag is turned off, actual arguments passed to func‐
1919 tions will be handled the same way as actual arguments passed to
1920 subroutines. This means that ftnchek will assume that arguments
1921 may be modified by the functions. No warnings will be given if
1922 a function is found to have side effects. Because stricter
1923 checking is possible if functions are assumed to be pure, you
1924 should turn this flag off only if your program actually uses
1925 functions with side effects.
1926
1927
1928 -quiet
1929 This option reduces the amount of output relating to normal
1930 operation, so that error messages are more apparent. This
1931 option is provided for the convenience of users who are checking
1932 large suites of files. The eliminated output includes the names
1933 of project files, and the message reporting that no syntax
1934 errors were found. It also eliminates some blank lines that are
1935 ordinarily included for clarity. (Some of this output is turned
1936 back on by the -list and -symtab options.) Default = no.
1937
1938 Note: the way to remember the difference between the -quiet and
1939 -brief is that -quiet doesn't suppress any warning-related
1940 information, whereas -brief does.
1941
1942 See also: -brief.
1943
1944
1945 -reference
1946 Specifies that a who-calls-who table be printed. This table
1947 lists each subprogram followed by a list of the routines it
1948 calls. This switch is equivalent to -calltree=reference.
1949 Default = no.
1950
1951 The reference list omits routines called by unused library mod‐
1952 ules. Thus it contains the same information as for the call-
1953 tree format, namely the hierarchy of subprogram calls, but
1954 printed in a different way. This prints out a breadth-first
1955 traversal of the call tree whereas -calltree=tree prints out a
1956 depth-first traversal.
1957
1958 See also: -calltree, -crossref, -library, -sort, -symtab, -vcg.
1959
1960
1961 -resources
1962 Prints the amount of resources used by ftnchek in processing the
1963 program. This listing may be useful in analyzing the size and
1964 complexity of a program. It can also help in choosing larger
1965 sizes for ftnchek's internal tables if they are too small to
1966 analyze a particular program. Default = no.
1967
1968 In this listing, the term ``chunk size'' is the size of the
1969 blocks of memory allocated to store the item in question, in
1970 units of the size of one item, not necessarily in bytes. When
1971 the initially allocated space is filled up, more memory is allo‐
1972 cated in chunks of this size. The following is an explanation
1973 of the items printed:
1974
1975 Source lines processed:
1976 Total number of lines of code, with separate totals for
1977 statement lines and comment lines. Comment lines include
1978 lines with 'C' or '*' in column 1 as well as blank lines and
1979 lines containing only an inline comment. Statement lines
1980 are all other lines, including lines that have an inline
1981 comment following some code. Continuation lines are counted
1982 as separate lines. Lines in include files are counted each
1983 time the file is included.
1984
1985 Total executable statements:
1986 Number of statements in the program, other than specifica‐
1987 tion, data, statement-function, FORMAT, ENTRY, and END
1988 statements.
1989
1990 Total number of modules:
1991 A module is any external subprogram, including the main pro‐
1992 gram, subroutines, functions, and block data units. This
1993 count is of modules defined within the source, not modules
1994 referenced. Statement functions are not included. A sub‐
1995 program with multiple entry points is only counted once.
1996
1997 Total statement labels defined
1998 Number of labels attached to statements (often called state‐
1999 ment numbers). The total label count for the entire program
2000 is given, as well as the maximum number in any single sub‐
2001 program.
2002
2003 Max identifier name chars:
2004 Number of characters used for storing identifier names. An
2005 identifier is a variable, subprogram, or common block name.
2006 Local names are those of local variables in a subprogram,
2007 whereas global names refer to subprogram and common block
2008 names, as well as dummy argument names and common variable
2009 names. Actual argument text (up to 15 characters for each
2010 argument) is also included here. The space used for local
2011 names is not recovered at the end of each module, so this
2012 number, like global space, grows until the whole program is
2013 analyzed. Unfortunately, this figure may include some text
2014 stored more than once, although a heuristic is used that
2015 will avoid duplicates in many cases.
2016
2017 Max token text chars:
2018 A token is the smallest syntactic unit of the FORTRAN lan‐
2019 guage above the level of individual characters. For instance
2020 a token can be a variable name, a numerical constant, a
2021 quoted text string, or a punctuation character. Token text
2022 is stored while a module is being processed. For technical
2023 reasons, single-character tokens are not included in this
2024 total. Items that are not represented in the symbol table
2025 may be duplicated. The space for token text is recovered at
2026 the end of each module, so this figure represents the maxi‐
2027 mum for any one module.
2028
2029 Max local symbols:
2030 This is the largest number of entries in the local symbol
2031 table for any module. Local symbol table entries include
2032 all variables and parameters, common block names, statement
2033 functions, external subprograms and intrinsic functions ref‐
2034 erenced by the module. Literal constants are not stored in
2035 the local symbol table.
2036
2037 Max global symbols:
2038 This is the number of entries in the global symbol table at
2039 the end of processing. Global symbol table entries include
2040 external subprogram and common block names. Intrinsic func‐
2041 tions and statement functions are not included.
2042
2043 Max number of tokenlists:
2044 A token list is a sequence of tokens representing the actual
2045 or dummy argument list of a subprogram, or the list of vari‐
2046 ables in a common block or namelist. Therefore this number
2047 represents the largest sum of COMMON, CALL, NAMELIST and
2048 ENTRY statements and function invocations for any one mod‐
2049 ule. The space is recovered at the end of each module.
2050
2051 Max token list/tree space:
2052 This is the largest number of tokens in all the token lists
2053 and token trees of any one module. A token tree is formed
2054 when analyzing an expression: each operand is a leaf of the
2055 tree, and the operators are the nodes. Therefore this num‐
2056 ber is a measure of the maximum complexity of an individual
2057 module. For instance a module with many long arithmetic
2058 expressions will have a high number. Note that unlike token
2059 text described above, the number of tokens is independent of
2060 the length of the variable names or literal constants in the
2061 expressions.
2062
2063 Number of subprogram invocations:
2064 This is the sum over all modules of the number of CALL
2065 statements and function invocations (except intrinsic func‐
2066 tions and statement functions).
2067
2068 Number of common block decls:
2069 This is the sum over all modules of the number of common
2070 block declarations. That is, each declaration of a block in
2071 a different module is counted separately. (The standard
2072 allows multiple declarations of a block within the same mod‐
2073 ule; these are counted as only one declaration since they
2074 are equivalent to a single long declaration.)
2075
2076 Number of array dim & param ptrs:
2077 This is the sum over all modules of the number of array
2078 dimension and parameter definition text strings saved for
2079 use by the -makedcls option. The length of the text strings
2080 is not counted. Each dimension of a multidimensional array
2081 is counted separately.
2082
2083 These numbers are obviously not the same when project files are
2084 used in place of the original source code. Even the numbers for
2085 global entities may be different, since some redundant informa‐
2086 tion is eliminated in project files.
2087
2088
2089 -sixchar
2090 One of the goals of the ftnchek program is to help users to
2091 write portable Fortran programs. One potential source of non‐
2092 portability is the use of variable names that are longer than
2093 six characters. Some compilers just ignore the extra charac‐
2094 ters. This behavior could potentially lead to two different
2095 variables being considered as the same. For instance, variables
2096 named AVERAGECOST and AVERAGEPRICE are the same in the first six
2097 characters. If you wish to catch such possible conflicts, use
2098 this flag. Default = no.
2099
2100 Use the -f77=long-names if you want to list all variables longer
2101 than six characters, not just those pairs that are the same in
2102 the first six.
2103
2104 See also: -f77, -portability.
2105
2106
2107 -sort
2108 Specifies that a sorted list of all modules used in the program
2109 be printed. This list is in ``prerequisite'' order, i.e. each
2110 module is printed only after all the modules from which it is
2111 called have been printed. This is also called a ``topological
2112 sort'' of the call tree. Each module is listed only once. Rou‐
2113 tines that are not in the call tree of the main program are
2114 omitted. If there are any cycles in the call graph (illegal in
2115 standard Fortran) they will be detected and diagnosed. Default
2116 = no.
2117
2118 See also: -calltree, -crossref, -reference, -symtab, -vcg.
2119
2120
2121 -source=list
2122 This setting controls certain options about the form of the For‐
2123 tran source code. The list consists of keywords separated by
2124 commas or colons. There are three special keywords: all to turn
2125 on all the options, none to turn them all off, and help to print
2126 the list of all the keywords with a brief explanation of each.
2127 If list is omitted, -source is equivalent to -source=all, and
2128 -nosource is equivalent to -source=none.
2129
2130 For compatibility with previous versions of ftnchek, a numeric
2131 form of this setting is also accepted: the list is replaced by
2132 a number which is the sum of the numbers in parentheses beside
2133 the keywords in the following list. (The fixed and free options
2134 do not have numeric values.) The warning keywords with their
2135 meanings are as follows:
2136
2137 fixed:
2138 Interpret the source as fixed form (with supported exten‐
2139 sions such as exclamation mark for comments). Statements
2140 must be in columns 7 to 72 (unless the -cols setting has
2141 been used to change this), and blanks are not significant
2142 outside character context (but warned about under the
2143 -pretty option). This is the default mode unless the
2144 source file extension is .f90 or .F90. this option cannot
2145 be given together with -source=free.
2146
2147 free: Interpret the source as free form. Statements may be any‐
2148 where in columns 1 to 132, comments can only begin with an
2149 exclamation mark, and blanks are required in some places
2150 such as between identifiers and keywords. This is the
2151 default mode if the source file extension is .f90 or .F90.
2152 This option cannot be given together with -source=fixed or
2153 -source=dec-tab
2154
2155 dec-tab (1):
2156 Accept DEC-style tab-formatted source. A line beginning
2157 with an initial tab will be treated as a new statement
2158 line unless the character after the tab is a nonzero
2159 digit, in which case it is treated as a continuation line.
2160 The next column after the tab or continuation mark is
2161 taken as column 7. A warning will be given in the case
2162 where the line is a continuation, if -f77=dec-tab is in
2163 effect.
2164
2165 vms-include (2):
2166 Accept VMS-style INCLUDE statements. These follow the
2167 normal syntax, but with the following additional features:
2168 (1) the file extension, if not given, defaults to the same
2169 as a normal source file extension; and (2) the option
2170 /LIST or /NOLIST can be appended to the include-file name,
2171 to control listing of its contents.
2172
2173 unix-backslash (4):
2174 Handle UNIX-style backslash escapes in character strings.
2175 The escape sequence following the backslash will be evalu‐
2176 ated according to the ANSI standard for strings in C: up
2177 to three digits signify an octal value, an x signifies the
2178 start of a hexadecimal constant, any of the letters a b f
2179 n r t signify special control codes, and any other charac‐
2180 ter (including newline) signifies the character itself.
2181 When this source code option is in effect, a warning will
2182 be given if the -f77=backslash setting is specified.
2183
2184 The default behavior is to treat the backslash like any
2185 other normal character, but a warning about portability
2186 will be generated if the -portability flag is set.
2187 Because of the fact that some compilers treat the back‐
2188 slash in a nonstandard way, it is possible for standard-
2189 conforming programs to be non-portable if they use the
2190 backslash character in strings.
2191
2192 Since ftnchek does not do much with the interpreted
2193 string, it is seldom necessary to use this option. It is
2194 needed in order to avoid spurious warnings only if (a) the
2195 program being checked uses backslash to embed an apostro‐
2196 phe or quote mark in a string instead of using the stan‐
2197 dard mechanism of doubling the delimiter; (b) the back‐
2198 slash is used to escape the end-of-line in order to con‐
2199 tinue a string across multiple source lines; or (c) a
2200 PARAMETER definition uses an intrinsic string function
2201 such as LEN with such a string as argument, and that value
2202 is later used to define array dimensions, etc.
2203
2204 param-implicit-type (8):
2205 Implicit typing of a parameter by the data type of the
2206 value assigned. Some non-standard compilers may allow the
2207 data type of the value to override the Fortran 77 default
2208 type of a parameter that is based on the first letter of
2209 the parameter name. This option only applies to PARAMETER
2210 statements of the standard form which has parentheses. A
2211 parameter that has been explicitly declared in a type
2212 statement prior to the PARAMETER statement is not affected
2213 by this option. A warning will be given under the
2214 -f77=param-implicit-type or -portabil‐
2215 ity=param-implicit-type option.
2216
2217 Note that this implicit typing is treated as equivalent to
2218 an explicit type declaration for the parameter. There‐
2219 fore, if you use -makedcls=undeclared-only to generate
2220 declarations only of undeclared variables, these parame‐
2221 ters will not be included.
2222
2223 dec-param-standard-type (16):
2224 Follow the Fortran 77 rule for data typing of DEC Fortran
2225 style parameters. These are declared using a nonstandard
2226 form of the PARAMETER statement which lacks parentheses.
2227 According to DEC Fortran, parameters defined by this form
2228 of the statement have their data type given by the data
2229 type of the value assigned. Use this option to tell
2230 ftnchek not to follow this rule but instead to use the
2231 same rule as for standard PARAMETER statements. This
2232 option does not apply to PARAMETER statements of the stan‐
2233 dard form.
2234
2235 By default, all these source code options are turned off, except
2236 for the vms-include option, which is on by default in the VMS
2237 version..
2238
2239 See also: -f77, -include, -portability.
2240
2241
2242 -style=list
2243 Provides extra-picky warnings about obsolescent or old-fashioned
2244 programming constructions. This option is helpful for efforts
2245 to follow a modern programming style. (Most of the things com‐
2246 plained about under this option are forbidden in the F subset
2247 language.) By default, all warnings are turned off.
2248
2249 The list consists of keywords separated by commas or colons.
2250 There are three special keywords: all to turn on all the
2251 options, none to turn them all off, and help to print the list
2252 of all the keywords with a brief explanation of each. If list
2253 is omitted, -style is equivalent to -style=all, and -nostyle is
2254 equivalent to -style=none. The warning keywords with their
2255 meanings are as follows:
2256
2257 block-if:
2258 Complain about arithmetic IF statement. Accept block IF
2259 or logical IF (which controls a single statement).
2260
2261 construct-name:
2262 Complain about unnamed block constructs: IF, DO, and
2263 SELECT CASE. Note that if a construct name is present on
2264 the opening statement of a construct, then it is required
2265 to be present on all other component statements (ELSE, END
2266 IF, etc.) of the construct. In that case a missing con‐
2267 struct name on those statements generates a syntax error
2268 regardless of this option. The purpose of this option is
2269 to warn if the construct completely lacks the optional
2270 name.
2271
2272 distinct-do:
2273 Complain if two DO loops share a common terminator state‐
2274 ment.
2275
2276 do-construct:
2277 Complain if terminator of a DO loop is anything other than
2278 an END DO or CONTINUE statement. This is the requirement
2279 in order for the loop to meet the Fortran 90 definition of
2280 a do-construct.
2281
2282 do-enddo:
2283 Complain if terminator of a DO loop is anything other than
2284 an END DO statement. (This option overrides the do-con‐
2285 struct option, being even stricter.)
2286
2287 end-name:
2288 Complain about the absence of the subprogram name on
2289 structured END statements.
2290
2291 format-stmt:
2292 Complain about the presence of FORMAT statements. Only
2293 the FORMAT statements themselves are flagged, not the ref‐
2294 erences to them in I/O lists.
2295
2296 goto: Complain about the presence of unconditional, computed or
2297 assigned GOTO statements. Also complain about alternate
2298 returns (but not about labels as subprogram arguments).
2299
2300 labeled-stmt:
2301 Complain about the presence of labels (numbers) on state‐
2302 ments other than FORMAT statements. (Since FORMAT state‐
2303 ments are arguably convenient and not readily abused, com‐
2304 plaints about them are controlled by the separate for‐
2305 mat-stmt keyword.)
2306
2307 program-stmt:
2308 Complain about the absence of a PROGRAM statement at the
2309 head of the main program.
2310
2311 structured-end:
2312 Complain about the use of a plain END statement to end a
2313 subprogram, rather than a structured END statement (END
2314 PROGRAM, END SUBROUTINE, END FUNCTION, or END BLOCK DATA).
2315
2316 See also: -f77, -f90, -f95, -pretty, -portability.
2317
2318
2319 -symtab
2320 A symbol table will be printed out for each module, listing all
2321 identifiers mentioned in the module. This table gives the name
2322 of each variable, its datatype, and the number of dimensions for
2323 arrays. An asterisk (*) indicates that the variable has been
2324 implicitly typed, rather than being named in an explicit type
2325 declaration statement. The table also lists all subprograms
2326 invoked by the module, all COMMON blocks declared, etc. Default
2327 = no.
2328
2329 Also, for each module, a label table will be printed. The table
2330 lists each label defined in the module; the line on which said
2331 statement label is defined; and the statement type (executable,
2332 format, or specification). The labels are listed in sequential
2333 order.
2334
2335 Also printed is a table describing the I/O units used by the
2336 module, together with information about how they are used: what
2337 operations are performed, whether the access is sequential or
2338 direct, and whether the I/O is formatted or unformatted.
2339
2340 See also: -calltree, -crossref, -list, -reference, -sort, -vcg.
2341
2342
2343 -truncation=list
2344 Warn about possible truncation (or roundoff) errors. Most of
2345 these are related to integer arithmetic. By default, all warn‐
2346 ings are turned on.
2347
2348 This setting provides detailed control over the warnings about
2349 possible truncation errors. The list consists of keywords sepa‐
2350 rated by commas or colons. Since all warnings are on by
2351 default, include a keyword prefixed by no- to turn off a partic‐
2352 ular warning. There are three special keywords: all to turn on
2353 all the warnings about truncation, none to turn them all off,
2354 and help to print the list of all the keywords with a brief
2355 explanation of each. If list is omitted, -truncation is equiva‐
2356 lent to -truncation=all, and -notruncation is equivalent to
2357 -truncation=none. The warning keywords with their meanings are
2358 as follows:
2359
2360 int-div-exponent:
2361 use of the result of integer division as an exponent.
2362 This suggests that a real quotient is intended. An exam‐
2363 ple would be writing X**(1/3) to evaluate the cube root of
2364 X. The correct expression is X**(1./3.).
2365
2366 int-div-real:
2367 Conversion of an expression involving an integer division
2368 to real. This suggests that a real quotient is intended.
2369
2370 int-div-zero:
2371 division in an integer constant expression that yields a
2372 result of zero.
2373
2374 int-neg-power:
2375 exponentiation of an integer by a negative integer (which
2376 yields zero unless the base integer is 1 in magnitude).
2377 This suggests that a real base is intended.
2378
2379 promotion:
2380 automatic conversion of a lower precision quantity to one
2381 of higher precision. The loss of accuracy for real vari‐
2382 ables in this process is comparable to the corresponding
2383 demotion. No warning is given for promotion of integer
2384 quantities to real since this is ordinarily exact.
2385
2386 real-do-index:
2387 use of a non-integer DO index in a loop with integer
2388 bounds. An integer DO index with real bounds is always
2389 warned about regardless of this setting.
2390
2391 real-subscript:
2392 use of a non-integer array subscript.
2393
2394 significant-figures:
2395 overspecifying a single precision constant. This may
2396 indicate that a double precision constant was intended.
2397
2398 size-demotion:
2399 automatic conversion of a higher precision quantity to one
2400 of lower precision of the same type. This warning only
2401 occurs when an explicit size is used in declaring the type
2402 of one or both operands in an assignment. For example, a
2403 warning wil be issued where a REAL*8 variable is assigned
2404 to a REAL variable, if the default wordsize of 4 is in
2405 effect. A warning is also issued if a long integer is
2406 assigned to a shorter one, for example, if an INTEGER
2407 expression is assigned to an INTEGER*2 variable. There is
2408 one exception to this last case, namely if the right hand
2409 side of the assignment is a small literal constant (less
2410 than 128). type-demotion: automatic conversion of a
2411 higher precision quantity to one of lower precision of
2412 different type. This warning includes conversion of real
2413 quantities to integer, double precision to single preci‐
2414 sion real, and assignment of a longer character string to
2415 a shorter one.
2416
2417 The warnings about promotion and demotion also apply to complex
2418 constants, considering the precision to be that of the real or
2419 imaginary part. Warnings about promotions and demotions are
2420 given only when the conversion is done automatically, e.g. in
2421 expressions of mixed precision or in an assignment statement.
2422 If intrinsic functions such as INT are used to perform the con‐
2423 version, no warning is given.
2424
2425 See also: -portability, -wordsize.
2426
2427
2428 -usage=list
2429 Warn about unused or possible uninitialized variables, unused
2430 common blocks, undefined or unused statement labels, and unused
2431 or undefined subprograms. By default, all warnings are turned
2432 on.
2433
2434 This setting provides detailed control over the warnings about
2435 possible usage errors. The list consists of keywords separated
2436 by commas or colons. Since all warnings are on by default,
2437 include a keyword prefixed by no- to turn off a particular warn‐
2438 ing. There are three special keywords: all to turn on all the
2439 warnings about usage, none to turn them all off, and help to
2440 print the list of all the keywords with a brief explanation of
2441 each. If list is omitted, -usage is equivalent to -usage=all,
2442 and -nousage is equivalent to -usage=none. These warnings cover
2443 four main categories of objects: subprogram dummy arguments,
2444 common blocks and variables, subprograms and functions, and
2445 local variables. Warnings include undefined items, multiply
2446 defined items, unused items, etc. The warning keywords with
2447 their meanings are as follows:
2448
2449 arg-alias:
2450 a scalar dummy argument is actually the same as another
2451 and is (or may be) modified. The Fortran 77 standard
2452 (section 15.9.3.6) prohibits modifying an argument that is
2453 aliased to another.
2454
2455 arg-array-alias:
2456 a dummy argument which is an array or array element is in
2457 the same array as another and is modified. This flag is
2458 similar to arg-alias but provides separate control over
2459 array arguments. It is harder to tell if aliasing is
2460 occurring in the case of arrays, so if ftnchek gives too
2461 many false warnings, this flag allows the array-related
2462 ones to be turned off without suppressing the warnings for
2463 scalars.
2464
2465 arg-common-alias:
2466 a scalar dummy argument is the same as a common variable
2467 in the subprogram, and either is modified. This is also
2468 prohibited by the Fortran 77 standard. If common checking
2469 is not exact (see the -common setting), it is harder to
2470 tell if aliasing is occurring, so the warning is given if
2471 the variable is anywhere in a common block that is
2472 declared by the subprogram.
2473
2474 arg-common-array-alias:
2475 a dummy argument which is an array or array element is in
2476 the same array as a common variable, and either is modi‐
2477 fied. If common checking is not exact, the variable can
2478 be anywhere in a common block that is declared by the sub‐
2479 program.
2480
2481 arg-const-modified:
2482 a subprogram modifies an argument which is a constant or
2483 an expression. Such an action could cause anomalous
2484 behavior of the program.
2485
2486 arg-unused:
2487 a dummy argument is declared but never used. This is sim‐
2488 ilar to the var-unused keyword described below, but
2489 applies only to arguments.
2490
2491 com-block-unused:
2492 a common block is declared but none of the variables in it
2493 are used by any subprogram. This warning is suppressed if
2494 the common strictness setting is 0.
2495
2496 com-block-volatile:
2497 a common block may lose the definition of its contents if
2498 common blocks are volatile. This option only has an
2499 effect if the -common=volatile flag is in effect. See the
2500 discussion of the -common setting above.
2501
2502 com-var-set-unused:
2503 a common variable is assigned a value, but its value is
2504 not used by any subprogram. This warning is suppressed if
2505 the common strictness setting is 0.
2506
2507 com-var-uninitialized:
2508 a common variable's value is used in some subprogram, but
2509 is not set anywhere. Unfortunately, ftnchek does not do a
2510 thorough enough analysis of the calling sequence to know
2511 which routines are called before others. So warnings
2512 about this type of error will only be given for cases in
2513 which a variable is used in some routine but not set in
2514 any other routine. Checking of individual COMMON vari‐
2515 ables is done only if the -common setting is 3 (variable
2516 by variable agreement). This warning is suppressed if the
2517 common strictness setting is 0.
2518
2519 com-var-unused:
2520 a common variable is declared but not used by any subpro‐
2521 gram. This warning is suppressed if the common strictness
2522 setting is 0.
2523
2524 do-index-modified:
2525 a variable that is the index of a DO loop is modified by
2526 some statement within the range of the loop. The Standard
2527 permits an active DO variable to be modified only by the
2528 incrementation mechanism of the DO statement.
2529
2530 ext-multiply-defined:
2531 an external (a subroutine or function) is defined more
2532 than once. Definition of an external means providing the
2533 body of its source code.
2534
2535 ext-declared-only:
2536 a name is declared in an EXTERNAL statement in some mod‐
2537 ule, but is not defined or used anywhere.
2538
2539 ext-undefined:
2540 an external is used (invoked) but not defined anywhere.
2541 This option is equivalent to the -external flag. If the
2542 subprogram is invoked more than once, those invocations
2543 will still be checked for consistency.
2544
2545 ext-unused:
2546 an external is defined (its subprogram body is present)
2547 but it is not used. A subprogram is considered unused
2548 even if it is invoked by some other subprogram, if it can‐
2549 not be called from any thread of execution starting with
2550 the main program. The agreement of the subprogram's argu‐
2551 ments with its invocations is still checked even if this
2552 warning is turned off. If there is no main program, then
2553 this warning is issued only if the subprogram is not
2554 invoked anywhere. This warning is suppressed in library
2555 mode, but library mode has the additional effect of sup‐
2556 pressing argument checking for unused routines.
2557
2558 label-undefined:
2559 a statement refers to a label that has not been defined.
2560
2561 label-unused:
2562 a statement label is defined, but never referred to.
2563
2564 var-set-unused:
2565 a local variable is assigned a value, but that value is
2566 not used.
2567
2568 var-uninitialized:
2569 a local variable's value may be used before it is
2570 assigned. Sometimes ftnchek makes a mistake in the warn‐
2571 ings about local variable usage. Usually it errs on the
2572 side of giving a warning where no problem exists, but in
2573 rare cases it may fail to warn where the problem does
2574 exist. See the section on Bugs for examples. If vari‐
2575 ables are equivalenced, the rule used by ftnchek is that a
2576 reference to any variable implies the same reference to
2577 all variables it is equivalenced to. For arrays, the rule
2578 is that a reference to any array element is treated as a
2579 reference to all elements of the array.
2580
2581 var-unused:
2582 a local variable is declared (for instance, in a type dec‐
2583 laration) but is not used in the module. Does not apply
2584 to dummy arguments: warnings about them are controlled by
2585 the keyword arg-unused described above.
2586
2587 Note: In versions of ftnchek prior to 2.10, the -usage flag took
2588 a numeric argument instead of a list of options. For the sake
2589 of users who may have written scripts invoking ftnchek in this
2590 way, the numeric form is still accepted. The numeric setting is
2591 composed of three digits. The first digit (hundreds place) con‐
2592 trols warnings about subprograms (functions and subroutines),
2593 the second digit (tens place) warnings about common blocks and
2594 common variables,, and the third digit (ones place) warnings
2595 about local variables. Each digit controls warnings according
2596 to the convention that a 1 means warn about undefined items and
2597 variables that are used before set, a 2 means warn about items
2598 that are unused, and a 3 means warn about both types. These
2599 numbers are now converted to the appropriate values for the
2600 above-listed keywords, except for com-block-volatile, which is
2601 not affected by the numeric argument.
2602
2603 See also: -common, -declare, -extern, -library.
2604
2605
2606 -vcg
2607 Produce the call graph in the form of a VCG graph description.
2608 This description is written to a separate file, with the same
2609 stem as the file containing the main program, and suffix .vcg.
2610 This file is able to be given directly to xvcg(1L) to visualize
2611 the call graph. (If input is from the standard input, then the
2612 graph description is sent to standard output.) This switch is
2613 equivalent to -calltree=vcg. Default = no.
2614
2615 The VCG description as created is more complex than it need be.
2616 VCG allows graphs and nested subgraphs: each subroutine is cre‐
2617 ated as a subgraph nested inside its calling routines. This
2618 allows you to interactively display subgraphs or summarise them.
2619
2620 The -vcg option for ftnchek was written by Dr. Philip Rubini of
2621 Cranfield University, UK.
2622
2623 xvcg is a graph visualisation tool which runs under the X win‐
2624 dows system. It is freely available from ftp.cs.uni-sb.de. It
2625 was written by G. Sander of the University of Saarland, Germany.
2626
2627 See also: -calltree, -crossref, -reference, -sort.
2628
2629
2630 -version
2631 This option causes ftnchek to print a line giving the version
2632 number, release date, and patch level of the program. If no
2633 files are given, it then exits. If files are given, the effect
2634 of this option is to include the patch level (normally omitted)
2635 in the version information printed at the start of processing.
2636 Default = no.
2637
2638 See also: -help.
2639
2640
2641 -volatile
2642 Assume that COMMON blocks are volatile. Default = no.
2643
2644 This flag is superseded by -common=volatile, and should no
2645 longer be used. It may be eliminated in a future release of
2646 ftnchek.
2647
2648 See also: -common, -usage.
2649
2650
2651 -wordsize=num
2652 Specifies the default word size to be num bytes. This is the
2653 size of logical and single-precision numeric variables that are
2654 not given explicit precisions. (Explicit precisions for non-
2655 character variables are an extension to the Fortran 77 Standard,
2656 and are given by type declarations such as REAL*8 X.) Double-
2657 precision and complex variables will be twice this value, and
2658 double complex variables four times. Quad-precision constants
2659 and intrinsic function results will be four times this value.
2660 Note that variables declared as REAL*16 will be regarded as quad
2661 precision only if the word size is 4 bytes. Default = turn-on =
2662 4 bytes.
2663
2664 The word size value does not matter for checking standard-con‐
2665 forming programs that do not declare explicit precisions for
2666 non-character variables or store Hollerith data in variables.
2667 This setting also does not affect the default size of character
2668 variables, which is always 1 byte. Hollerith constants also are
2669 assumed to occupy 1 byte per character.
2670
2671 The word size is used to determine whether truncation occurs in
2672 assignment statements, and to catch precision mismatches in sub‐
2673 program argument lists and common block lists. The exact warn‐
2674 ings that are issued will depend on the status of other flags.
2675 Under both the -portability=mixed-size and the -nowordsize flag,
2676 any mixing of explicit with default precision objects (character
2677 expressions not included) is warned about. This applies to
2678 arithmetic expressions containing both types of objects, and to
2679 subprogram arguments and COMMON variables. Under control of the
2680 -truncation=demotion and promotion options, a warning is given
2681 for assignment of an expression to a shorter variable of the
2682 same type, or for promotion of a lower precision value to higher
2683 precision in an arithmetic expression or an assignment state‐
2684 ment.
2685
2686 Giving a word size of 0, or equivalently, using -nowordsize
2687 means that no default value will be assumed. This is equivalent
2688 to specifying -portability=mixed-size. Use it to find cases of
2689 mixing default and explicit precision, for example to flag
2690 places where REAL*8 is treated as equivalent to DOUBLE PRECI‐
2691 SION.
2692
2693 See also: -pointersize, -portability, -truncation.
2694
2695
2696 -wrap=col
2697 Controls the wrapping of error messages. Long error messages
2698 that would run past the specified column will be broken up into
2699 separate lines between the words of the message for better read‐
2700 ability. If turned off with -nowrap, each separate error mes‐
2701 sage will be printed on one line, leaving it up to the display
2702 to wrap the message or truncate it. Default = turn-on = 79.
2703
2704
2706 ftnchek includes two mechanisms for changing the default values of all
2707 options: by defining environment variables or by creating a preferences
2708 file. When ftnchek starts up, it looks in its environment for any
2709 variables whose names are composed by prefixing the string FTNCHEK_
2710 onto the uppercased version of the option name. If such a variable is
2711 found, its value is used to specify the default for the corresponding
2712 switch or setting. In the case of settings (for example, the -common
2713 strictness setting) the value of the environment variable is read as
2714 the default setting value. In the case of switches, the default switch
2715 will be taken as true or yes unless the environment variable has the
2716 value 0 or NO.
2717
2718 Note that the environment variable name must be constructed with the
2719 full-length option name, which must be in uppercase. For example, to
2720 make ftnchek print a source listing by default, set the environment
2721 variable FTNCHEK_LIST to 1 or YES or anything other than 0 or NO. The
2722 names FTNCHEK_LIS (not the full option name) or ftnchek_list (lower
2723 case) would not be recognized.
2724
2725 Here are some examples of how to set environment variables on various
2726 systems. For simplicity, all the examples set the default -list switch
2727 to YES.
2728
2729 1. UNIX, Bourne shell: $ FTNCHEK_LIST=YES
2730 $ export FTNCHEK_LIST
2731
2732 2. UNIX, C shell: % setenv FTNCHEK_LIST YES
2733
2734 3. VAX/VMS: $ DEFINE FTNCHEK_LIST YES
2735
2736 4. MSDOS: $ SET FTNCHEK_LIST=YES
2737
2738 After processing any environment variables, ftnchek looks for a prefer‐
2739 ences file containing options and settings. It will search in the fol‐
2740 lowing order, using only the first file found: (1) .ftnchekrc in the
2741 current directory, (2) ftnchek.ini in the current directory, (3)
2742 .ftnchekrc in the user's home directory, (4) ftnchek.ini in the home
2743 directory. If such a file is found, the options defined in it are used
2744 as defaults in place of the built-in defaults and overriding any
2745 defaults set in the environment..
2746
2747 Each option or setting in the preferences file must be on a separate
2748 line. They are given in the same form as on the command line, except
2749 without the initial dash. The preferences file can contain blank lines
2750 and comments. Comments are introduced at any point in a line by a
2751 space character (blank or tab) or the '#' character, and are terminated
2752 by the end of the line.
2753
2754 Command-line options override the defaults set in the environment or in
2755 the preferences file, in the same way as they override the built-in
2756 defaults.
2757
2758
2760 This section contains detailed information on how to use project files
2761 most effectively, and how to avoid some pitfalls.
2762
2763 One can divide the checks ftnchek does into two categories, local and
2764 global. Local checking is restricted to within a single routine, and
2765 catches things like uninitialized variables, unintended loss of preci‐
2766 sion in arithmetic expressions, etc. This sort of checking can be done
2767 on each subprogram independently. Furthermore, local checking of a
2768 subprogram does not need to be repeated when some other subprogram is
2769 changed. Global checking catches things like calling a subroutine with
2770 the wrong argument types, or disagreeing in common block declarations.
2771 It requires looking at the whole set of subprograms interacting with
2772 each other.
2773
2774 The purpose of project files is to allow the local checking and global
2775 checking steps to be separated. Assuming that each subprogram is in
2776 its own source file, you can run ftnchek once on each one to do local
2777 checking while suppressing global checking. Then ftnchek can be run
2778 once on all the project files together to do the global checking. The
2779 sample makefile below shows how to automate this task. The ``.f.prj''
2780 target updates a project file for a particular file any time the source
2781 file changes. The information needed for global checking is saved in
2782 the project file. The ``check'' target does the combined global check‐
2783 ing. Typically ``make check'' would repeat the ``ftnchek -project''
2784 step only on changed source files, then do the global check. This is
2785 obviously a big advantage for large programs, when many subprograms
2786 seldom if ever change.
2787
2788 It is best when using project files to place each subprogram in a sepa‐
2789 rate source file. If each source file may contain more than one sub‐
2790 program, it complicates the definition of ``local'' and ``global''
2791 checking because there is some inter-module checking that is contained
2792 within a file. ftnchek tries to do the right thing in this case, but
2793 there are some complications (described below) due to the trade-off
2794 between avoiding re-doing cross-checks and preserving information about
2795 the program's structure.
2796
2797 Ordinarily, to do the least amount of re-checking, project files should
2798 be created with the -library flag in effect and trimming turned on. In
2799 this mode, the information saved in the project file consists of all
2800 subprogram declarations, all subprogram invocations not resolved by
2801 declarations in the same file, and one instance of each COMMON block
2802 declaration. This is the minimum amount of information needed to check
2803 agreement between files.
2804
2805 If the source file contains more than one routine, there are some pos‐
2806 sible problems that can arise from creating the project file in library
2807 mode, because the calling hierarchy among routines defined within the
2808 file is lost. Also, if the routines in the file make use of COMMON
2809 blocks that are shared with routines in other files, there will not be
2810 enough information saved for the correct checking of set and used sta‐
2811 tus of COMMON blocks and COMMON variables according to the -usage set‐
2812 ting. Therefore if you plan to use project files when -usage checking
2813 is turned on (which is the default situation), and if multiple routines
2814 in one project file share COMMON blocks with routines in other files,
2815 the project files should be created with the -library flag turned off.
2816 In this mode, ftnchek saves, besides the information listed above, one
2817 invocation of each subprogram by any other subprogram in the same file,
2818 and all COMMON block declarations. This means that the project file
2819 will be larger than necessary, and that when it is read in, ftnchek may
2820 repeat some inter-module checks that it already did when the project
2821 file was created. If each project file contains only one module, there
2822 is no loss of information in creating the project files in library
2823 mode.
2824
2825 Because of the possible loss of information entailed by creating a
2826 project file with the -library flag in effect, whenever that project
2827 file is read in later, it will be treated as a library file regardless
2828 of the current setting of the -library flag. On the other hand, a
2829 project file created with library mode turned off can be read in later
2830 in either mode.
2831
2832 The foregoing discussion assumes that the trimming options of the
2833 -project setting are turned on when the project file is created. This
2834 is the normal situation. The no-trim options of the -project setting
2835 are provided in case one wants to use the project files for purposes
2836 other than checking the program with ftnchek. For instance, one could
2837 write a Perl script to analyze the project files for information about
2838 how the different subprograms are called. You should not use the
2839 no-trim options to deal with the issues of information loss discussed
2840 above, since they cause more information than necessary to be stored.
2841 This makes the project files bigger and causes ftnchek to do more work
2842 later when it reads them to check your complete program. Ordinarily,
2843 you should use the -library option to control how much information to
2844 store for later use by ftnchek in checking your program.
2845
2846 Here is an example of how to use the UNIX make utility to automatically
2847 create a new project file each time the corresponding source file is
2848 altered, and to check the set of files for consistency. Add these
2849 lines to your makefile. The example assumes that a macro OBJS has been
2850 defined which lists all the names of object files to be linked together
2851 to form the complete executable program. (In this makefile, the
2852 indented lines should each begin with a tab, not blanks.) If any
2853 source file contains multiple routines that share common blocks among
2854 themselves, then the no-com-\* option should be removed from NOGLOBAL,
2855 and/or drop the -library flag.
2856 # tell make what a project file suffix is
2857 .SUFFIXES: .prj
2858
2859 # these options suppress global checks.
2860 NOGLOBAL=-usage=no-ext-undefined,no-com-\*
2861
2862 # tell make how to create a .prj file from a .f file
2863 .f.prj:
2864 ftnchek -project $(NOGLOBAL) -library $<
2865
2866 # set up macro PRJS containing project filenames
2867 PRJS= $(OBJS:.o=.prj)
2868
2869 # "make check" will check everything that has been changed.
2870 check: $(PRJS)
2871 ftnchek $(PRJS)
2872
2873 When a program uses many routines defined in a large number of differ‐
2874 ent source files in different directories, it can be cumbersome to
2875 specify all the different project files needed to check the program
2876 properly. To deal with such cases, ftnchek allows project files to be
2877 concatenated into a single large file. This single file can then be
2878 given to ftnchek to provide the information for checking the use of any
2879 or all of the routines defined in the combined project files. When
2880 using such a ``library'' project file, you may want ftnchek's error
2881 reports to document precisely the name of the file where the specific
2882 function is defined. If the various source files are in several direc‐
2883 tories, an error report that gives only the file name may be ambiguous,
2884 and rather should include the path to the file. The solution is to
2885 create each of the individual project files by giving the complete path
2886 to the source file. Then this complete path will appear in the error
2887 reports. For example, suppose that all of the library subprogram
2888 source files are in subdirectories of a directory named /util/lib.
2889 Then the individual project files could first be created by a command
2890 such as
2891 find /util/lib -name '*.f' -exec ftnchek -project '{}' ';'
2892 (Possibly other options would be provided to ftnchek as discussed
2893 above. Also, this step could be handled instead by a revised makefile
2894 rule that would provide the complete source file path instead of just
2895 the local name when invoking ftnchek.) Next, concatenate all of these
2896 project files manually.
2897 find /util/lib -name '*.prj' -exec cat '{}' ';' > ourlib.prj
2898 Then a program source file can be checked by using the command
2899 ftnchek prog.f ... -lib ourlib.prj
2900 and an error message related to any library routine will include the
2901 full path to the routine's source file.
2902
2903 At present, there is no archive utility like ar to manage the contents
2904 of a concatenated project file like the one in the illustration above.
2905 If changes are made to one of the library routines, the only way to
2906 update the combined project file is to concatenate all the individual
2907 project files once again. Such a utility would be quite easy to write.
2908 Someone should do so and contribute it to the ftnchek effort.
2909
2911 The following simple Fortran program illustrates the messages given by
2912 ftnchek. The program is intended to accept an array of test scores and
2913 then compute the average for the series.
2914
2915 C AUTHORS: MIKE MYERS AND LUCIA SPAGNUOLO
2916 C DATE: MAY 8, 1989
2917
2918 C Variables:
2919 C SCORE -> an array of test scores
2920 C SUM -> sum of the test scores
2921 C COUNT -> counter of scores read in
2922 C I -> loop counter
2923
2924 REAL FUNCTION COMPAV(SCORE,COUNT)
2925 INTEGER SUM,COUNT,J,SCORE(5)
2926
2927 DO 30 I = 1,COUNT
2928 SUM = SUM + SCORE(I)
2929 30 CONTINUE
2930 COMPAV = SUM/COUNT
2931 END
2932
2933
2934 PROGRAM AVENUM
2935 C
2936 C MAIN PROGRAM
2937 C
2938 C AUTHOR: LOIS BIGBIE
2939 C DATE: MAY 15, 1990
2940 C
2941 C Variables:
2942 C MAXNOS -> maximum number of input values
2943 C NUMS -> an array of numbers
2944 C COUNT -> exact number of input values
2945 C AVG -> average returned by COMPAV
2946 C I -> loop counter
2947 C
2948
2949 PARAMETER(MAXNOS=5)
2950 INTEGER I, COUNT
2951 REAL NUMS(MAXNOS), AVG
2952 COUNT = 0
2953 DO 80 I = 1,MAXNOS
2954 READ (5,*,END=100) NUMS(I)
2955 COUNT = COUNT + 1
2956 80 CONTINUE
2957 100 AVG = COMPAV(NUMS, COUNT)
2958 END
2959
2960 The compiler gives no error messages when this program is compiled.
2961 Yet here is what happens when it is run:
2962
2963 $ run average
2964 70
2965 90
2966 85
2967 <EOF>
2968 $
2969
2970 What happened? Why didn't the program do anything? The following is
2971 the output from ftnchek when it is used to debug the above program:
2972
2973
2974 $ ftnchek -list -symtab average
2975
2976 FTNCHEK Version 3.3 November 2004
2977
2978 File average.f:
2979
2980 1 C AUTHORS: MIKE MYERS AND LUCIA SPAGNUOLO
2981 2 C DATE: MAY 8, 1989
2982 3
2983 4 C Variables:
2984 5 C SCORE -> an array of test scores
2985 6 C SUM -> sum of the test scores
2986 7 C COUNT -> counter of scores read in
2987 8 C I -> loop counter
2988 9
2989 10 REAL FUNCTION COMPAV(SCORE,COUNT)
2990 11 INTEGER SUM,COUNT,J,SCORE(5)
2991 12
2992 13 DO 30 I = 1,COUNT
2993 14 SUM = SUM + SCORE(I)
2994 15 30 CONTINUE
2995 16 COMPAV = SUM/COUNT
2996 ^
2997 Warning near line 16 col 20: integer quotient expr SUM/COUNT converted to
2998 real
2999 17 END
3000
3001 Module COMPAV: func: real
3002
3003 Variables:
3004
3005 Name Type Dims Name Type Dims Name Type Dims Name Type Dims
3006 COMPAV real COUNT intg I intg* J intg
3007 SCORE intg 1 SUM intg
3008
3009 * Variable not declared. Type has been implicitly defined.
3010
3011
3012 Warning in module COMPAV: Variables declared but never referenced:
3013 J declared at line 11
3014
3015 Warning in module COMPAV: Variables may be used before set:
3016 SUM used at line 14
3017 SUM set at line 14
3018
3019
3020 Statement labels defined:
3021
3022 Label Line StmtType
3023 <30> 15 exec
3024
3025 18
3026 19
3027 20 PROGRAM AVENUM
3028 21 C
3029 22 C MAIN PROGRAM
3030 23 C
3031 24 C AUTHOR: LOIS BIGBIE
3032 25 C DATE: MAY 15, 1990
3033 26 C
3034 27 C Variables:
3035 28 C MAXNOS -> maximum number of input values
3036 29 C NUMS -> an array of numbers
3037 30 C COUNT -> exact number of input values
3038 31 C AVG -> average returned by COMPAV
3039 32 C I -> loop counter
3040 33 C
3041 34
3042 35 PARAMETER(MAXNOS=5)
3043 36 INTEGER I, COUNT
3044 37 REAL NUMS(MAXNOS), AVG
3045 38 COUNT = 0
3046 39 DO 80 I = 1,MAXNOS
3047 40 READ (5,*,END=100) NUMS(I)
3048 41 COUNT = COUNT + 1
3049 42 80 CONTINUE
3050 43 100 AVG = COMPAV(NUMS, COUNT)
3051 44 END
3052
3053 Module AVENUM: prog
3054
3055 External subprograms referenced:
3056
3057 COMPAV: real*
3058
3059 Variables:
3060
3061 Name Type Dims Name Type Dims Name Type Dims Name Type Dims
3062 AVG real COUNT intg I intg MAXNOS intg*
3063 NUMS real 1
3064
3065 * Variable not declared. Type has been implicitly defined.
3066
3067
3068 Warning in module AVENUM: Variables set but never used:
3069 AVG set at line 43
3070
3071 I/O Operations:
3072
3073 Unit ID Unit No. Access Form Operation Line
3074 5 SEQ FMTD READ 40
3075
3076 Statement labels defined:
3077
3078 Label Line StmtType Label Line StmtType
3079 <80> 42 exec <100> 43 exec
3080
3081
3082 0 syntax errors detected in file average.f
3083 6 warnings issued in file average.f
3084
3085 Warning: Subprogram COMPAV argument data type mismatch at position 1:
3086 Dummy arg SCORE in module COMPAV line 10 file average.f is type intg
3087 Actual arg NUMS in module AVENUM line 43 file average.f is type real
3088
3089 According to ftnchek, the program contains variables which may be used
3090 before they are assigned an initial value, and variables which are not
3091 needed. ftnchek also warns the user that an integer quotient has been
3092 converted to a real. This may assist the user in catching an unintended
3093 roundoff error. Since the -symtab flag was given, ftnchek prints out a
3094 table containing identifiers from the local module and their corre‐
3095 sponding datatype and number of dimensions. Finally, ftnchek warns
3096 that the function COMPAV is not used with the proper type of arguments.
3097
3098 With ftnchek's help, we can debug the program. We can see that there
3099 were the following errors:
3100
3101 1. SUM and COUNT should have been converted to real before doing the
3102 division.
3103
3104 2. SUM should have been initialized to 0 before entering the loop.
3105
3106 3. AVG was never printed out after being calculated.
3107
3108 4. NUMS should have been declared INTEGER instead of REAL.
3109
3110 We also see that I, not J, should have been declared INTEGER in func‐
3111 tion COMPAV. Also, MAXNOS was not declared as INTEGER, nor COMPAV as
3112 REAL, in program AVENUM. These are not errors, but they may indicate
3113 carelessness. As it happened, the default type of these variables
3114 coincided with the intended type.
3115
3116 Here is the corrected program, and its output when run:
3117
3118 C AUTHORS: MIKE MYERS AND LUCIA SPAGNUOLO
3119 C DATE: MAY 8, 1989
3120 C
3121 C Variables:
3122 C SCORE -> an array of test scores
3123 C SUM -> sum of the test scores
3124 C COUNT -> counter of scores read in
3125 C I -> loop counter
3126 C
3127 REAL FUNCTION COMPAV(SCORE,COUNT)
3128 INTEGER SUM,COUNT,I,SCORE(5)
3129 C
3130 SUM = 0
3131 DO 30 I = 1,COUNT
3132 SUM = SUM + SCORE(I)
3133 30 CONTINUE
3134 COMPAV = FLOAT(SUM)/FLOAT(COUNT)
3135 END
3136 C
3137 C
3138 PROGRAM AVENUM
3139 C
3140 C MAIN PROGRAM
3141 C
3142 C AUTHOR: LOIS BIGBIE
3143 C DATE: MAY 15, 1990
3144 C
3145 C Variables:
3146 C MAXNOS -> maximum number of input values
3147 C NUMS -> an array of numbers
3148 C COUNT -> exact number of input values
3149 C AVG -> average returned by COMPAV
3150 C I -> loop counter
3151 C
3152 C
3153 INTEGER MAXNOS
3154 PARAMETER(MAXNOS=5)
3155 INTEGER I, NUMS(MAXNOS), COUNT
3156 REAL AVG,COMPAV
3157 COUNT = 0
3158 DO 80 I = 1,MAXNOS
3159 READ (5,*,END=100) NUMS(I)
3160 COUNT = COUNT + 1
3161 80 CONTINUE
3162 100 AVG = COMPAV(NUMS, COUNT)
3163 WRITE(6,*) 'AVERAGE =',AVG
3164 END
3165 $ run average
3166 70
3167 90
3168 85
3169 <EOF>
3170 AVERAGE = 81.66666
3171 $
3172
3173 With ftnchek's help, our program is a success!
3174
3175
3177 The messages given by ftnchek include not only syntax errors but also
3178 warnings and informational messages about things that are legal Fortran
3179 but that may indicate errors or carelessness. Most of these messages
3180 can be turned off by command-line options. Which option controls each
3181 message depends on the nature of the condition being warned about. See
3182 the descriptions of the command-line flags in the previous sections,
3183 and of individual messages below. Each message is prefixed with a word
3184 or phrase indicating the nature of the condition and its severity.
3185
3186 ``Error'' means a syntax error. The simplest kind of syntax errors are
3187 typographical errors, for example unbalanced parentheses or misspelling
3188 of a keyword. This type of error is caught by the parser and appears
3189 with the description ``parse error'' or ``syntax error'' (depending on
3190 the version of the parser generator and whether it is GNU bison or UNIX
3191 yacc). This type of error message cannot be suppressed. Be aware that
3192 this type of error often means that ftnchek has not properly inter‐
3193 preted the statement where the error occurs, so that its subsequent
3194 checking operations will be compromised. You should eliminate all syn‐
3195 tax errors before proceeding to interpret the other messages ftnchek
3196 gives.
3197
3198 ``Warning: Nonstandard syntax'' indicates an extension to Fortran that
3199 ftnchek supports but that is not according to the Fortran 77 Standard.
3200 The extensions that ftnchek accepts are described in the section on
3201 Extensions below. One example is the DO ... ENDDO construction. If a
3202 program uses these extensions, warnings will be given according to
3203 specifications under the -f77 setting. The default behavior is to give
3204 no warnings.
3205
3206 ``Warning'' in other cases means a condition that is suspicious but
3207 that may or may not be a programming error. Frequently these condi‐
3208 tions are legal under the standard. Some are illegal but do not fall
3209 under the heading of syntax errors. Usage errors are one example.
3210 These refer to the possibility that a variable may be used before it
3211 has been assigned a value (generally an error), or that a variable is
3212 declared but never used (harmless but may indicate carelessness). The
3213 amount of checking for usage errors is controlled by the -usage flag,
3214 which specifies the maximum amount of checking by default.
3215
3216 Truncation warnings cover situations in which accuracy may be lost
3217 unintentionally, for example when a double precision value is assigned
3218 to a real variable. These warnings are controlled by the -truncation
3219 setting, which is on by default.
3220
3221 ``Nonportable usage'' warns about some feature that may not be accepted
3222 by some compilers even though it is not contrary to the Fortran 77
3223 Standard, or that may cause the program to perform differently on dif‐
3224 ferent platforms. For example, equivalencing real and integer vari‐
3225 ables is usually a non-portable practice. The use of extensions to the
3226 standard language is, of course, another source of non-portability, but
3227 this is handled as a separate case. To check a program for true porta‐
3228 bility, both the -portability and the -f77 flags should be used. They
3229 are both turned off by default. The -wordsize setting is provided to
3230 check only those nonportable usages that depend on a particular machine
3231 wordsize.
3232
3233 ``Possibly misleading appearance'' is used for legal constructions that
3234 may not mean what they appear to mean at first glance. For example,
3235 Fortran is insensitive to blank space, so extraneous space within vari‐
3236 able names or the lack of space between a keyword and a variable can
3237 convey the wrong impression to the reader. These messages can be sup‐
3238 pressed by turning off the -pretty flag, which is on by default.
3239
3240 Other messages that are given after all the files are processed, and
3241 having to do with agreement between modules, do not use the word
3242 ``warning'' but generally fall into that category. Examples include
3243 type mismatches between corresponding variables in different COMMON
3244 block declarations, or between dummy and actual arguments of a subpro‐
3245 gram. These warnings are controlled by the -common and -arguments set‐
3246 tings respectively. By default both are set for maximum strictness of
3247 checking.
3248
3249 Another group of warnings about conditions that are often harmless
3250 refer to cases where the array properties of a variable passed as a
3251 subprogram argument differ between the two routines. For instance, an
3252 array element might be passed to a subroutine that expects a whole
3253 array. This is a commonly-used technique for processing single rows or
3254 columns of two-dimensional arrays. However, it could also indicate a
3255 programming error. The -array setting allows the user to adjust the
3256 degree of strictness to be used in checking this kind of agreement
3257 between actual and dummy array arguments. By default the strictness is
3258 maximum.
3259
3260 ``Oops'' indicates a technical problem, meaning either a bug in ftnchek
3261 or that its resources have been exceeded.
3262
3263 The syntax error messages and warnings include the filename along with
3264 the line number and column number. ftnchek has two different options
3265 for the appearance of these error messages. If -novice is in effect,
3266 which is the default, the messages are in a style approximating normal
3267 English. (In default style, the filename is not printed in messages
3268 within the body of the program if -list is in effect.) The other style
3269 of error messages is selected by the -nonovice option. In this style,
3270 the appearance of the messages is similar to that of the UNIX lint pro‐
3271 gram.
3272
3273 ftnchek is still blind to some kinds of syntax errors. The two most
3274 important ones are detailed checking of FORMAT statements, and almost
3275 anything to do with control of execution flow by means of IF, DO, and
3276 GOTO statements: namely correct nesting of control structures, matching
3277 of opening statements such as IF ... THEN with closing statements such
3278 as ENDIF, and the proper use of statement labels (numbers). Most com‐
3279 pilers will catch these errors. See the section on Limitations for a
3280 more detailed discussion.
3281
3282 If ftnchek gives you a syntax error message when the compiler does not,
3283 it may be because your program contains an extension to standard For‐
3284 tran which is accepted by the compiler but not by ftnchek. (See the
3285 section on Extensions.) On a VAX/VMS system, you can use the compiler
3286 option /STANDARD to cause the compiler to accept only standard Fortran.
3287 On most UNIX or UNIX-like systems, this can be accomplished by setting
3288 the flag -ansi.
3289
3290 Many of the messages given by ftnchek are self-explanatory. Those that
3291 need some additional explanation are listed below in alphabetical
3292 order.
3293
3294 Common block NAME: data type mismatch at position n
3295 The n-th variable in the COMMON block differs in data type in
3296 two different declarations of the COMMON block. By default
3297 (-common strictness level 3), ftnchek is very picky about COMMON
3298 blocks: the variables listed in them must match exactly by data
3299 type and array dimensions. That is, the legal pair of declara‐
3300 tions in different modules:
3301 COMMON /COM1/ A,B
3302 and
3303 COMMON /COM1/ A(2)
3304 will cause ftnchek to give warnings at strictness level 3.
3305 These two declarations are legal in Fortran since they both
3306 declare two real variables. At strictness level 1 or 2, no
3307 warning would be given in this example, but the warning would be
3308 given if there were a data type mismatch, for instance, if B
3309 were declared INTEGER. Controlled by -common setting.
3310
3311
3312 Common block NAME has long data type following short data type
3313 Some compilers require alignment of multi-byte items so that
3314 each item begins at an address that is a multiple of the item
3315 size. Thus if a short (e.g. single-precision real) item is fol‐
3316 lowed by a long (e.g. double precision real) item, the latter
3317 may not be aligned correctly. Controlled by -portability=com‐
3318 mon-alignment option.
3319
3320
3321 Common block NAME has mixed character and non-character variables
3322 The ANSI standard requires that if any variable in a COMMON
3323 block is of type CHARACTER, then all other variables in the same
3324 COMMON block must also be of type CHARACTER. Controlled by
3325 -f77=mixed-common option.
3326
3327
3328 Common block NAME: varying length
3329 For -common setting level 2, this message means that a COMMON
3330 block is declared to have different numbers of words in two dif‐
3331 ferent subprograms. A word is the amount of storage occupied by
3332 one integer or real variable. For -common setting level 3, it
3333 means that the two declarations have different numbers of vari‐
3334 ables, where an array of any size is considered one variable.
3335 This is not necessarily an error, but it may indicate that a
3336 variable is missing from one of the lists. Note that according
3337 to the Fortran 77 Standard, it is an error for named COMMON
3338 blocks (but not blank COMMON) to differ in number of words in
3339 declarations in different modules. Given for -common setting 2
3340 or 3.
3341
3342
3343 Error: Badly formed logical/relational operator or constant
3344
3345 Error: Badly formed real constant
3346 The syntax analyzer has found the start of one of the special
3347 words that begin and end with a period (e.g. .EQ.), or the start
3348 of a numeric constant, but did not succeed in finding a complete
3349 item of that kind.
3350
3351
3352 Error: cannot be adjustable size in module NAME
3353 A character variable cannot be declared with a size that is an
3354 asterisk in parentheses unless it is a dummy argument, a parame‐
3355 ter, or the name of the function defined in the module.
3356
3357
3358 Error: cannot be declared in SAVE statement in module NAME
3359 Only local variables and common blocks can be declared in a SAVE
3360 statement.
3361
3362
3363 Error: No path to this statement
3364 ftnchek will detect statements which are ignored or by-passed
3365 because there is no foreseeable route to the statement. For
3366 example, an unnumbered statement (a statement without a state‐
3367 ment label), occurring immediately after a GOTO statement, can‐
3368 not possibly be executed.
3369
3370
3371 Error: Parse error
3372 This means that the parser, which analyzes the Fortran program
3373 into expressions, statements, etc., has been unable to find a
3374 valid interpretation for some portion of a statement in the pro‐
3375 gram. If your compiler does not report a syntax error at the
3376 same place, the most common explanations are: (1) use of an
3377 extension to ANSI standard Fortran that is not recognized by
3378 ftnchek, or (2) the statement requires more lookahead than
3379 ftnchek uses (see section on Bugs).
3380
3381 NOTE: This message means that the affected statement is not
3382 interpreted. Therefore, it is possible that ftnchek's subse‐
3383 quent processing will be in error, if it depends on any matters
3384 affected by this statement (type declarations, etc.).
3385
3386
3387 Error: Syntax error
3388 This is the same as ``Error: Parse error'' (see above). It is
3389 generated if your version of ftnchek was built using the UNIX
3390 yacc parser generator rather than GNU bison.
3391
3392
3393 Identifiers which are not unique in first six chars
3394 Warns that two identifiers which are longer than 6 characters do
3395 not differ in the first 6 characters. This is for portability:
3396 they may not be considered distinct by some compilers. Con‐
3397 trolled by -sixchar option.
3398
3399
3400 Nonportable usage: argument precision may not be correct for intrinsic
3401 function
3402 The precision of an argument passed to an intrinsic function may
3403 be incorrect on some computers. Issued when a numeric variable
3404 declared with explicit precision (e.g. REAL*8 X) is passed to a
3405 specific intrinsic function (e.g. DSQRT(X)). Controlled by
3406 -portability=mixed-size and -wordsize.
3407
3408
3409 Nonportable usage: character constant/variable length exceeds 255
3410 Some compilers do not support character strings more than 255
3411 characters in length. Controlled by -portability=long-string.
3412
3413
3414 Nonportable usage: File contains tabs
3415 ftnchek expands tabs to be equivalent to spaces up to the next
3416 column which is a multiple of 8. Some compilers treat tabs dif‐
3417 ferently, and also it is possible that files sent by electronic
3418 mail will have the tabs converted to blanks in some way. There‐
3419 fore files containing tabs may not be compiled correctly after
3420 being transferred. ftnchek does not give this message if tabs
3421 only occur within comments or character constants. Controlled
3422 by -portability=tab.
3423
3424
3425 Nonportable usage: non-integer DO loop bounds
3426 This warning is only given when the DO index and bounds are non-
3427 integer. Use of non-integer quantities in a DO statement may
3428 cause unexpected errors, or different results on different
3429 machines, due to roundoff effects. Controlled by -portabil‐
3430 ity=real-do.
3431
3432
3433 Possibly it is an array which was not declared
3434 This message is appended to warnings related to a function invo‐
3435 cation or to an argument type mismatch, for which the possibil‐
3436 ity exists that what appears to be a function is actually meant
3437 to be an array. If the programmer forgot to dimension an array,
3438 references to the array will be interpreted as function invoca‐
3439 tions. This message will be suppressed if the name in question
3440 appears in an EXTERNAL or INTRINSIC statement. Controlled by
3441 the -novice option.
3442
3443
3444 Possibly misleading appearance: characters past 72 columns
3445 The program is being processed with the statement field width at
3446 its standard value of 72, and some nonblank characters have been
3447 found past column 72. In this case, ftnchek is not processing
3448 the characters past column 72, and is notifying the user that
3449 the statement may not have the meaning that it appears to have.
3450 These characters might be intended by the programmer to be sig‐
3451 nificant, but they will be ignored by the compiler. Controlled
3452 by -pretty=long-line.
3453
3454
3455 Possibly misleading appearance: Common block declared in more than one
3456 statement
3457 Such multiple declarations are legal and have the same effect as
3458 a continuation of the original declaration of the block. This
3459 warning is only given if the two declarations are separated by
3460 one or more intervening statements. Controlled by -pretty=mul‐
3461 tiple-common.
3462
3463
3464 Possibly misleading appearance: Continuation follows comment or blank
3465 line
3466 ftnchek issues this warning message to alert the user that a
3467 continuation of a statement is interspersed with comments, mak‐
3468 ing it easy to overlook. Controlled by -pretty=continuation.
3469
3470
3471 Possibly misleading appearance: Extraneous parentheses
3472 Warns about parentheses surrounding a variable by itself in an
3473 expression. When a parenthesized variable is passed as an argu‐
3474 ment to a subprogram, it is treated as an expression, not as a
3475 variable whose value can be modified by the called routine.
3476 Controlled by -pretty=parentheses.
3477
3478
3479 Subprogram NAME: argument data type mismatch at position n
3480 The subprogram's n-th actual argument (in the CALL or the usage
3481 of a function) differs in datatype or precision from the n-th
3482 dummy argument (in the SUBROUTINE or FUNCTION declaration). For
3483 instance, if the user defines a subprogram by
3484 SUBROUTINE SUBA(X)
3485 REAL X
3486 and elsewhere invokes SUBA by
3487 CALL SUBA(2)
3488 ftnchek will detect the error. The reason here is that the num‐
3489 ber 2 is integer, not real. The user should have written
3490 CALL SUBA(2.0)
3491
3492 When checking an argument which is a subprogram, ftnchek must be
3493 able to determine whether it is a function or a subroutine. The
3494 rules used by ftnchek to do this are as follows: If the subpro‐
3495 gram, besides being passed as an actual argument, is also
3496 invoked directly elsewhere in the same module, then its type is
3497 determined by that usage. If not, then if the name of the sub‐
3498 program does not appear in an explicit type declaration, it is
3499 assumed to be a subroutine; if it is explicitly typed it is
3500 taken as a function. Therefore, subroutines passed as actual
3501 arguments need only be declared by an EXTERNAL statement in the
3502 calling module, whereas functions must also be explicitly typed
3503 in order to avoid generating this error message. Controlled by
3504 -arguments setting.
3505
3506
3507 Subprogram NAME: argument arrayness mismatch at position n
3508 Similar to the preceding situation, but the subprogram dummy
3509 argument differs from the corresponding actual argument in its
3510 number of dimensions or number of elements. Controlled by
3511 -array together with -arguments settings.
3512
3513
3514 Subprogram NAME: argument mismatch at position n
3515 A character dummy argument is larger than the corresponding
3516 actual argument, or a Hollerith dummy argument is larger than
3517 the corresponding actual argument. Controlled by -arguments
3518 setting.
3519
3520
3521 Subprogram NAME: argument usage mismatch
3522 ftnchek detects a possible conflict between the way a subprogram
3523 uses an argument and the way in which the argument is supplied
3524 to the subprogram. The conflict can be one of two types, as
3525 outlined below.
3526
3527
3528 Dummy arg is modified, Actual arg is const or expr
3529 A dummy argument is an argument as named in a SUBROUTINE or
3530 FUNCTION statement and used within the subprogram. An actual
3531 argument is an argument as passed to a subroutine or function by
3532 the caller. ftnchek is saying that a dummy argument is modified
3533 by the subprogram, implying that its value is changed in the
3534 calling module. The corresponding actual argument should not be
3535 a constant or expression, but rather a variable or array element
3536 which can be legitimately assigned to. Controlled by the
3537 -usage=arg-const-modified option.
3538
3539
3540 Dummy arg used before set, Actual arg not set
3541 Here a dummy argument may be used in the subprogram before hav‐
3542 ing a value assigned to it by the subprogram. The corresponding
3543 actual argument should have a value assigned to it by the caller
3544 prior to invoking the subprogram. Controlled by the
3545 -usage=var-uninitialized option.
3546
3547 This warning is not affected by the -arguments setting.
3548
3549
3550 Subprogram NAME invoked inconsistently
3551 Here the mismatch is between the datatype of the subprogram
3552 itself as used and as defined. For instance, if the user
3553 declares
3554 INTEGER FUNCTION COUNT(A)
3555 and invokes COUNT in another module as
3556 N = COUNT(A)
3557 without declaring its datatype, it will default to real type,
3558 based on the first letter of its name. The calling module
3559 should have included the declaration
3560 INTEGER COUNT
3561
3562 Given for -arguments setting 2 or 3.
3563
3564
3565 Subprogram NAME: varying length argument lists:
3566 An inconsistency has been found between the number of dummy
3567 arguments (parameters) a subprogram has and the number of actual
3568 arguments given it in an invocation. ftnchek keeps track of all
3569 invocations of subprograms (CALL statements and expressions
3570 using functions) and compares them with the definitions of the
3571 subprograms elsewhere in the source code. The Fortran compiler
3572 normally does not catch this type of error. Given for -argu‐
3573 ments setting 1 or 3.
3574
3575
3576 Variable not declared. Type has been implicitly defined
3577 When printing the symbol table for a module, ftnchek will flag
3578 with an asterisk all identifiers that are not explicitly typed
3579 and will show the datatype that was assigned through implicit
3580 typing. This provides support for users who wish to declare all
3581 variables as is required in Pascal or some other languages.
3582 This message appears only when the -symtab option is in effect.
3583 Alternatively, use the -declare flag if you want to get a list
3584 of all undeclared variables.
3585
3586
3587 Variables declared but never referenced
3588 Detects any identifiers that were declared in your program but
3589 were never used, either to be assigned a value or to have their
3590 value accessed. Variables in COMMON are excluded. Controlled
3591 by the -usage=var-unused option.
3592
3593
3594 Variables set but never used
3595 ftnchek will notify the user when a variable has been assigned a
3596 value, but the variable is not otherwise used in the program.
3597 Usually this results from an oversight. Controlled by the
3598 -usage=var-set-unused option.
3599
3600
3601 Variables used before set
3602 This message indicates that an identifier is used to compute a
3603 value prior to its initialization. Such usage may lead to an
3604 incorrect value being computed, since its initial value is not
3605 controlled. Controlled by the -usage=var-uninitialized option.
3606
3607
3608 Variables may be used before set
3609 Similar to used before set except that ftnchek is not able to
3610 determine its status with certainty. ftnchek assumes a variable
3611 may be used before set if the first usage of the variable occurs
3612 prior in the program text to its assignment. Controlled by the
3613 -usage=var-uninitialized option.
3614
3615
3616 Warning: DO index is not integer
3617 This warning is only given when the DO bounds are integer, but
3618 the DO index is not. It may indicate a failure to declare the
3619 index to be an integer. Controlled by -truncation=real-do
3620 option.
3621
3622
3623 Warning: integer quotient expr ... converted to real
3624 The quotient of two integers results in an integer type result,
3625 in which the fractional part is dropped. If such an integer
3626 expression involving division is later converted to a real
3627 datatype, it may be that a real type division had been intended.
3628 Controlled by -truncation=int-div-real option.
3629
3630
3631 Warning: Integer quotient expr ... used in exponent
3632 The quotient of two integers results in an integer type result,
3633 in which the fractional part is dropped. If such an integer
3634 expression is used as an exponent, it is quite likely that a
3635 real type division was intended. Controlled by -trunca‐
3636 tion=int-div-exponent option.
3637
3638
3639 Warning: NAME not set when RETURN encountered
3640 The way that functions in Fortran return a value is by assigning
3641 the value to the name of the function. This message indicates
3642 that the function was not assigned a value before the point
3643 where a RETURN statement was found. Therefore it is possible
3644 that the function could return an undefined value.
3645
3646
3647 Warning: Nonstandard syntax: adjustable size cannot be concatenated
3648 here
3649 The Fortran 77 Standard (sec. 6.2.2) forbids concatenating char‐
3650 acter variables whose size is an asterisk in parentheses, except
3651 in an assignment statement. Controlled by -f77=mixed-expr.
3652
3653
3654 Warning: Nonstandard syntax : significant characters past 72 columns
3655 This warning is given under the -f77=long-line setting if the
3656 -columns setting has been used to increase the statement field
3657 width, and a statement has meaningful program text beyond column
3658 72. Standard Fortran ignores all text in those columns, but
3659 some compilers do not. Thus the program may be treated differ‐
3660 ently by different compilers.
3661
3662
3663 Warning: Nonstandard syntax : Statement out of order.
3664 ftnchek will detect statements that are out of the sequence
3665 specified for ANSI standard Fortran 77. Table 1 illustrates the
3666 allowed sequence of statements in the Fortran language. State‐
3667 ments which are out of order are nonetheless interpreted by
3668 ftnchek, to prevent ``cascades'' of error messages. The
3669 sequence counter is also rolled back to prevent repetition of
3670 the error message for a block of similar statements. Controlled
3671 by the -f77=statement-order option.
3672
3673 --------------------------------------------------------
3674 | | implicit
3675 | parameter |---------------------
3676 | | other specification
3677 format |---------------|---------------------
3678 and | | statement-function
3679 entry | data |---------------------
3680 | | executable
3681 --------------------------------------------------------
3682
3683 Table 1
3684
3685
3686 Warning: Possible division by zero
3687 This message is printed out wherever division is done (except
3688 division by a constant). Use it to help locate a runtime divi‐
3689 sion by zero problem. Controlled by -division option.
3690
3691
3692 Warning: real truncated to intg
3693 ftnchek has detected an assignment statement which has a real
3694 expression on the right, but an integer variable on the left.
3695 The fractional part of the real value will be lost. If you
3696 explicitly convert the real expression to integer using the INT
3697 or NINT intrinsic function, no warning will be printed. A simi‐
3698 lar message is printed if a double precision expression is
3699 assigned to a single precision variable, etc. Controlled by
3700 -truncation=demotion option.
3701
3702
3703 Warning: subscript is not integer
3704 Since array subscripts are normally integer quantities, the use
3705 of a non-integer expression here may signal an error. Con‐
3706 trolled by -truncation=real-subscript option.
3707
3708
3709 Warning: Unknown intrinsic function
3710 This message warns the user that a name declared in an INTRINSIC
3711 statement is unknown to ftnchek. Probably it is a nonstandard
3712 intrinsic function, and so the program will not be portable.
3713 The function will be treated by ftnchek as a user-defined func‐
3714 tion. This warning is not suppressed by any option, since it
3715 affects ftnchek's analysis of the program. However, if the
3716 intrinsic function is in one of the supported sets of nonstan‐
3717 dard intrinsics, you can use the -intrinsic setting to cause
3718 ftnchek to recognize it.
3719
3720
3722 ftnchek accepts ANSI standard Fortran-77 programs with some minor limi‐
3723 tations and numerous common extensions.
3724
3725 Limitations:
3726 The dummy arguments in statement functions are treated like
3727 ordinary variables of the program. That is, their scope is the
3728 entire subprogram, not just the statement function definition.
3729
3730 The checking of FORMAT statements is lax, tolerating missing
3731 separators (comma, etc.) between format descriptors in places
3732 where the Standard requires them, and allowing .d fields on
3733 descriptors that should not have them. It does warn under
3734 -f77=format-edit-descr about nonstandard descriptor types (like
3735 O), and supported extensions.
3736
3737 There are some syntactic extensions and Fortran 90 elements that
3738 ftnchek accepts but does very little checking. For instance,
3739 pointer usage (whether the nonstandard Cray syntax or the For‐
3740 tran 90 syntax) is not checked other than for set and used sta‐
3741 tus. It is hoped that some day more thorough checking will be
3742 implemented, but for now the user should regard the acceptance
3743 of these syntactic features simply as a convenience to enable
3744 checking of other aspects of code that contains them. See the
3745 section Extensions for specifics about what features are
3746 accepted but not fully checked.
3747
3748 If a user-supplied subprogram has the same name as one of the
3749 nonstandard intrinsic functions recognized by ftnchek, it must
3750 be declared in an EXTERNAL statement in any routine that invokes
3751 it. Otherwise it will be subject to the checking normally given
3752 to the intrinsic function. Since the nonstandard intrinsics are
3753 not standard, this EXTERNAL statement is not required by the
3754 Fortran 77 Standard. Using the -intrinsic=none setting, recog‐
3755 nition of most nonstandard intrinsics (excepting only those
3756 needed to support the double complex data type) can be turned
3757 off. See the lists of supported nonstandard intrinsic functions
3758 under the discussion of the -intrinsic setting above.
3759
3760 Extensions:
3761 All of these extensions (except lower-case characters) will gen‐
3762 erate warnings if the relevant -f77 option is set. Some of the
3763 extensions listed below are part of the Fortran-90 Standard.
3764 These are indicated by the notation (F90).
3765
3766 Tabs are permitted, and translated into equivalent blanks which
3767 correspond to tab stops every 8 columns. The standard does not
3768 recognize tabs. Note that some compilers allow tabs, but treat
3769 them differently. The treatment defined for DEC FORTRAN can be
3770 achieved using the -source=dec-tab setting.
3771
3772 Strings may be delimited by either quote marks or apostrophes.
3773 A sequence of two delimiter characters is interpreted as a sin‐
3774 gle embedded delimiter character. (F90)
3775
3776 Strings may contain UNIX-style backslash escape sequences. They
3777 will be interpreted as such if the -source=unix-backslash set‐
3778 ting is given. Otherwise the backslash character will be
3779 treated as a normal printing character.
3780
3781 Source code can be in either Fortran 90 free format or tradi‐
3782 tional fixed format. (F90)
3783
3784 A semicolon is allowed as a statement separator. (F90)
3785
3786 Lower case characters are permitted, and are converted inter‐
3787 nally to uppercase except in character strings. The standard
3788 specifies upper case only, except in comments and strings.
3789 (F90)
3790
3791 Hollerith constants are permitted, in accordance with the For‐
3792 tran 77 Standard, appendix C. They should not be used in
3793 expressions, or confused with datatype CHARACTER.
3794
3795 The letter 'D' (upper or lower case) in column 1 is treated as
3796 the beginning of a comment. There is no option to treat such
3797 lines as statements instead of comments.
3798
3799 Statements may be longer than 72 columns provided that the set‐
3800 ting -columns was used to increase the limit. According to the
3801 standard, all text from columns 73 through 80 is ignored, and no
3802 line may be longer than 80 columns.
3803
3804 Variable names may be longer than six characters. The standard
3805 specifies six as the maximum. ftnchek permits names up to 31
3806 characters long (F90).
3807
3808 Variable names may contain underscores and dollar signs (or
3809 other non-alphabetic characters as specified by the -identi‐
3810 fier-chars option). These characters are are treated the same
3811 as alphabetic letters. The default type for variables beginning
3812 with these characters is REAL. In IMPLICIT type statements
3813 specifying a range of characters, the dollar sign follows Z and
3814 is followed by underscore. (Any other user-defined characters
3815 are treated the same as the dollar sign.) Fortran 90 permits
3816 underscores in variable names.
3817
3818 The UNIX version tolerates the presence of preprocessor direc‐
3819 tives, namely lines beginning with the pound sign (#). These
3820 are treated as comments, except for #line directives, which are
3821 interpreted, and are used to set the line number and source file
3822 name for warnings and error messages. Note that #include direc‐
3823 tives are not processed by ftnchek. Programs that use them for
3824 including source files should be passed through the preprocessor
3825 before being input to ftnchek. As noted below, ftnchek does
3826 process INCLUDE statements, which have a different syntax. An
3827 optional program, ftnpp(1L) (available separately) provides
3828 preprocessing that properly handles INCLUDE files.
3829
3830 The Fortran 90 DO ... ENDDO control structure is permitted.
3831 The CYCLE and EXIT statements are accepted. All of these may
3832 have an optional do-construct name, but construct names are not
3833 checked for consistency. (F90)
3834
3835 The Fortran 90 SELECT CASE construct is accepted. (F90)
3836
3837 Construct names are also accepted on IF, THEN, ELSE, ENDIF and
3838 SELECT CASE statements. (F90)
3839
3840 The ACCEPT and TYPE statements (for terminal I/O) are permitted,
3841 with the same syntax as PRINT.
3842
3843 The so-called ``Cray pointer'' syntax is tolerated. It is not
3844 the same as the Fortran 90 POINTER statement. There is no real
3845 checking of the statement other than basic syntax. The form of
3846 this statement is
3847 POINTER (pointer, pointee) [,(pointer, pointee)]
3848 The pointer variables are assigned a data type of INTEGER *4.
3849 Usage checking of the pointee variables is suppressed, since in
3850 practice they are accessed indirectly via the pointers.
3851
3852 The following Fortran 90 pointer related syntaxes are accepted:
3853 ALLOCATABLE, POINTER, and TARGET statements and the same
3854 attributes in type declarations; ALLOCATE, DEALLOCATE, and NUL‐
3855 LIFY executable statements; pointer assignment using => opera‐
3856 tor; and the intrinsic functions ALLOCATED and ASSOCIATED. Lit‐
3857 tle semantic checking of pointer variables and operations is
3858 done beyond basic set and used status. For instance, there is
3859 no checking for such errors as dangling pointers, or use of
3860 unallocated arrays.
3861
3862 Statements may have any number of continuation lines. The For‐
3863 tran 77 and Fortran 90 standards allow a maximum of 19 in fixed
3864 source form. The Fortran 90 standard allows a maximum of 39 in
3865 free source form.
3866
3867 Relational (comparison) operators composed of punctuation,
3868 namely: < <= == /= > >= are allowed. (F90)
3869
3870 Inline comments, beginning with an exclamation mark, are permit‐
3871 ted. (F90)
3872
3873 NAMELIST I/O is supported. The syntax is the same as in Fortran
3874 90.
3875
3876 FORMAT statements can contain a dollar sign to indicate suppres‐
3877 sion of carriage-return. An integer expression enclosed in
3878 angle brackets can be used anywhere in a FORMAT statement where
3879 the Fortran 77 Standard allows an integer constant (except for
3880 the length of a Hollerith constant), to provide a run-time value
3881 for a repeat specification or field width.
3882
3883 Nonstandard keywords are allowed in I/O statements, correspond‐
3884 ing to those in VMS Fortran.
3885
3886 The IMPLICIT NONE statement is supported. The meaning of this
3887 statement is that all variables must have their data types
3888 explicitly declared. Rather than flag the occurrences of such
3889 variables with syntax error messages, ftnchek waits till the end
3890 of the module, and then prints out a list of all undeclared
3891 variables, as it does for the -declare option. (F90)
3892
3893 Data types INTEGER, REAL, COMPLEX, and LOGICAL are allowed to
3894 have an optional precision specification in type declarations.
3895 For instance, REAL*8 means an 8-byte floating point data type.
3896 The REAL*8 datatype is not necessarily considered equivalent to
3897 DOUBLE PRECISION, depending on the -wordsize setting. The For‐
3898 tran 77 Standard allows a length specification only for CHARAC‐
3899 TER data.
3900
3901 ftnchek supports the DOUBLE COMPLEX type specification for a
3902 complex quantity whose real and imaginary parts are double pre‐
3903 cision. Mixed-mode arithmetic involving single-precision com‐
3904 plex with double-precision real data, prohibited under the Stan‐
3905 dard, yields a double complex result.
3906
3907 Combined type declarations and data-statement-like initializers
3908 are accepted. These have the form of a standard Fortran 77 type
3909 declaration, followed by a slash-delimited list of constants
3910 like that used in a DATA statement. An example of the syntax is
3911 INTEGER N / 100 /
3912 This bastard form of initializing declaration was not adopted in
3913 Fortran 90. Such declarations should be written using the stan‐
3914 dard form described below, which is accepted by ftnchek.
3915
3916 There is limited support for Fortran 90 attribute-based type
3917 declarations. This style of declaration is distinguished by the
3918 use of a double colon (::) between the list of attributes and
3919 the list of declared variables. The features supported may be
3920 adequate for novice programmers, but are not yet sufficient for
3921 professional-quality Fortran 90 programs. I hope to add support
3922 for more features in future releases. I invite volunteers to
3923 assist in this task. See the ToDo file in the source code dis‐
3924 tribution for details. The attributes currently accepted,
3925 besides all the usual data types, are DIMENSION, EXTERNAL,
3926 INTRINSIC, PARAMETER, and SAVE. The new form of declaration
3927 also allows assignment of values to the variables declared. At
3928 present, the (LEN=value) form of specifying character lengths is
3929 also accepted. Kind specifications, using (KIND=value) are
3930 parsed but are not processed: all kinds are treated as default
3931 kind. Also, there is little checking of these declarations
3932 beyond basic syntax.
3933
3934 Many commonly found nonstandard intrinsic functions are pro‐
3935 vided. See the discussion of -intrinsic for a list of functions
3936 and how to control which ones are recognized.
3937
3938 Argument checking is not tight for those nonstandard intrinsics
3939 that take arrays or mixed argument types.
3940
3941 ftnchek permits the INCLUDE statement, which causes inclusion of
3942 the text of the given file. The syntax is
3943 INCLUDE 'filename'
3944 This is compatible with Fortran 90. If the -source=vms-include
3945 option is given, ftnchek follows VMS conventions with respect to
3946 this statement: it assumes a default extension of .for if no
3947 filename extension is given, and allows the qualifier /[NO]LIST
3948 following the filename, to control the listing of the included
3949 file. There is no support for including VMS text modules.
3950
3951 In diagnostic output relating to items contained in include
3952 files, the location of the error is specified by both its loca‐
3953 tion in the include file and the location in the parent file
3954 where the file was included.
3955
3956 ftnchek accepts PARAMETER statements which lack parentheses.
3957 These will be warned about if the -f77=param-noparen flag is
3958 given.
3959
3960 ftnchek accepts PARAMETER definitions that involve intrinsic
3961 functions and exponentiation by a non-integer exponent. Both of
3962 these cases are prohibited by the Fortran 77 Standard, and will
3963 be warned about if the -f77=param-intrinsic flag is given. If
3964 an intrinsic function value is a compile-time integer constant,
3965 ftnchek will evaluate it. This allows better checking if the
3966 parameter is used in declaring array sizes. Fortran 90 allows
3967 intrinsic functions in PARAMETER definitions.
3968
3969 The intrinsic functions that are evaluated are:
3970
3971 ABS IABS DIM IDIM MAX
3972 MAX0 MIN MIN0 MOD SIGN
3973 ISIGN LEN ICHAR INDEX
3974
3975 The functions of integer arguments are evaluated only if the
3976 arguments are integer constant expressions. (These may involve
3977 integer constants, parameters, and evaluated intrinsic func‐
3978 tions.) The function LEN is evaluated if its argument is an
3979 expression involving only character constants and variables
3980 whose length is not adjustable. The functions ICHAR and INDEX
3981 are evaluated only if the arguments are character constants.
3982 ftnchek gives a warning if it needs the value of some intrinsic
3983 function that is not evaluated.
3984
3986 Here are the changes from Version 3.2 to Version 3.3:
3987
3988 1. Front-end has been rewritten for unlimited lookahead, eliminating
3989 the longstanding bug that caused incorrect interpretation of state‐
3990 ments whose ambiguity was not resolved in the first line.
3991
3992 2. The -mkhtml option is now available in the MS-DOS version.
3993
3994 3. Added support for Fortran 90 pointer related syntax: ALLOCATE,
3995 DEALLOCATE, and NULLIFY statements; the ALLOCATABLE, POINTER and
3996 TARGET attributes in type declarations; the pointer assigment oper‐
3997 ator => and intrinsic functions ALLOCATED and ASSOCIATED; and
3998 deferred-shape array declarations. At present these new syntax
3999 features are accepted but not properly checked. This feature was
4000 added by Robert Landrito.
4001
4002 4. The -f77 and -f90 pointer option controlling warnings about ``Cray
4003 pointers'' has been renamed to cray-pointer. The -f77=pointer
4004 option now instead controls warnings for code containing Fortran 90
4005 pointer-related syntax.
4006
4007 5. Re-implemented -mkhtml processing so it is now much faster on
4008 source files containing many routines.
4009
4010 6. Changed the arrangement of the test directory so there is no longer
4011 any need to modify the distribution in order to run the test suite
4012 (check.bat) under MS-DOS.
4013
4014 7. Fixed bug in reading numeric settings on command line when setting
4015 name abbreviated to 3 characters.
4016
4017 8. Fixed bug causing spurious warning for a GOTO referring to a
4018 labeled END statement when the statement before END was a FORMAT.
4019
4020 9. New flag -f77=character to control warnings about extensions to the
4021 Fortran 77 character data type. Accompanying this new flag is sup‐
4022 port for Fortran 90 rules for character variable declarations that
4023 evaluate to zero or negative length, allowing them and treating
4024 negative length values as zero.
4025
4026 10. Fixed minor bug in printing of comments and blank lines following
4027 last END statement in -list mode.
4028
4030 ftnchek still has much room for improvement. Your feedback is appreci‐
4031 ated. We want to know about any bugs you notice. Bugs include not
4032 only cases in which ftnchek issues an error message where no error
4033 exists, but also if ftnchek fails to issue a warning when it ought to.
4034 Note, however, that ftnchek is not intended to catch all syntax errors
4035 (see section on Limitations). Also, it is not considered a bug for a
4036 variable to be reported as used before set, if the reason is that the
4037 usage of the variable occurs prior in the text to where the variable is
4038 set. For instance, this could occur when a GOTO causes execution to
4039 loop backward to some previously skipped statements. ftnchek does not
4040 analyze the program flow, but assumes that statements occurring earlier
4041 in the text are executed before the following ones.
4042
4043 We especially want to know if ftnchek crashes for any reason. It is
4044 not supposed to crash, even on programs with syntax errors. Sugges‐
4045 tions are welcomed for additional features which you would find useful.
4046 Tell us if any of ftnchek's messages are incomprehensible. Comments on
4047 the readability and accuracy of this document are also welcome.
4048
4049 You may also suggest support for additional extensions to the Fortran
4050 language. These will be included only if it is felt that the exten‐
4051 sions are sufficiently widely accepted by compilers.
4052
4053 If you find a bug in ftnchek, first consult the list of known bugs
4054 below to see if it has already been reported. Also check the section
4055 entitled ``Limitations and Extensions'' above for restrictions that
4056 could be causing the problem. If you do not find the problem docu‐
4057 mented in either place, then send a report including
4058
4059 1. The operating system and CPU type on which ftnchek is running.
4060
4061 2. The version of ftnchek and values of any environment options or
4062 settings defined in startup file. (Capturing the output of ftnchek
4063 -help is useful for this.)
4064
4065 3. A brief description of the bug.
4066
4067 4. If possible, a small sample program showing the bug.
4068
4069 The report should be sent to Dr. Robert Moniot (see contact information
4070 in section entitled ``Installation and Support'').
4071
4072 Highest priority will be given to bugs which cause ftnchek to crash.
4073
4074 Certain problems that arise when checking large programs can be fixed
4075 by increasing the sizes of the data areas in ftnchek. (These problems
4076 are generally signaled by error messages beginning with ``Oops''.) The
4077 simplest way to increase the table sizes is by recompiling ftnchek with
4078 the LARGE_MACHINE macro name defined. Consult the makefile and README
4079 file for the method of doing this.
4080
4081 The following is a list of known bugs.
4082
4083 1. Bug: Used-before-set message is suppressed for any variable which
4084 is used as the loop index in an implied-do loop, even if it was in
4085 fact used before being set in some earlier statement. For example,
4086 consider J in the statement
4087
4088 WRITE(5,*) (A(J), J=1,10)
4089
4090 Here ftnchek parses the I/O expression, A(J), where J is used,
4091 before it parses the implied loop where J is set. Normally this
4092 would cause ftnchek to report a spurious used-before-set warning
4093 for J. Since this report is usually in error and occurs fairly
4094 commonly, ftnchek suppresses the warning for J altogether.
4095
4096 Prognosis: A future version of ftnchek is planned which will han‐
4097 dle implied-do loops correctly.
4098
4099 2. Bug: Variables used (not as arguments) in statement-function sub‐
4100 programs do not have their usage status updated when the statement
4101 function is invoked.
4102
4103 Prognosis: To be fixed in a future version of ftnchek.
4104
4105 3. Bug: VAX version does not expand wildcards in filenames on the com‐
4106 mand line if they are followed without space by an option, e.g.
4107 ftnchek *.f/calltree would not expand the *.f. This is because
4108 VMS-style options without intervening space are not supported by
4109 the GNU shell_mung routine that is used to expand wildcards.
4110
4111 Prognosis: unlikely to be fixed.
4112
4113 4. Bug: checking for nonstandard format edit descriptors is done only
4114 in FORMAT statements, not in character strings used as formats.
4115
4116 Prognosis: may be fixed someday.
4117
4118
4120 ftnchek was designed by Dr. Robert Moniot, professor at Fordham Univer‐
4121 sity. During the academic year of 1988-1989, Michael Myers and Lucia
4122 Spagnuolo developed the program to perform the variable usage checks.
4123 During the following year it was augmented by Lois Bigbie to check sub‐
4124 program arguments and COMMON block declarations. Brian Downing
4125 assisted with the implementation of the INCLUDE statement. John Quinn
4126 wrote the common block usage checks. Heba Elsayed wrote the label ta‐
4127 ble printout and label usage checks. Nelson H. F. Beebe of the Univer‐
4128 sity of Utah added most of the new code to implement the -makedcls fea‐
4129 ture and wrote the dcl2inc script. The -mkhtml feature was contributed
4130 by Mark McVeigh of Framatome ANP, Inc. The -reference feature was con‐
4131 tributed by Gerome Emmanuel, Ecole des mines, U. Nancy (slightly modi‐
4132 fied). The -vcg option was contributed by Dr. Philip Rubini of Cran‐
4133 field University, UK. The support for Cray pointer syntax was provided
4134 by John Dannenhoffer of United Technologies Research Center. John C.
4135 Bollinger of Indiana University added the parser syntax for the SELECT
4136 CASE construct. Robert Landrito added the parser syntax for F90
4137 pointer-related features. Additional features will be added as time
4138 permits. As of Version 2.5, the name was changed from forchek to
4139 ftnchek, to avoid confusion with a similar program named forcheck,
4140 developed earlier at Leiden University.
4141
4142 We would like to thank John Amor of the University of British Columbia,
4143 Reg Clemens of the Air Force Phillips Lab in Albuquerque, Markus
4144 Draxler of the University of Stuttgart, Victor Eijkhout of the Univer‐
4145 sity of Tennessee at Knoxville, Greg Flint of Purdue University, Daniel
4146 P. Giesy of NASA Langley Research Center, Fritz Keinert of Iowa State
4147 University, Judah Milgram of the University of Maryland College Park,
4148 Hugh Nicholas of the Pittsburgh Supercomputing Center, Dan Severance of
4149 Yale University, Phil Sterne of Lawrence Livermore National Laboratory,
4150 Larry Weissman of the University of Washington, Warren J. Wiscombe of
4151 NASA Goddard, and Nelson H. F. Beebe of the University of Utah, for
4152 pointing out bugs and suggesting some improvements. Stefan A.
4153 Deutscher, Gunnar Duus, Clive Page of the University of Leicester,
4154 Stephan Wefing of Heidelberg University, and Bob Wells of Oxford Uni‐
4155 versity were extremely helpful as alpha testers. We also thank Jack
4156 Dongarra for putting ftnchek into the netlib library of publicly avail‐
4157 able software.
4158
4160 The ftnchek program is free software. It can be obtained by anonymous
4161 ftp from many software servers, including ftp://netlib.org/fortran .
4162 Note that on Netlib the distribution is named ftnchek.tar.gz whereas on
4163 most other servers the file name includes the version number, e.g.
4164 ftnchek-3.3.0.tar.gz. If the file extension is .Z, uncompress with the
4165 Unix uncompress(1) utility. If the file extension is .gz, uncompress
4166 with the GNU gunzip(1L) program. Then use tar(1) to unpack the files
4167 into a subdirectory.
4168
4169 Installation requires a C compiler for your computer. See the INSTALL
4170 file provided with the distribution for instructions on installing
4171 ftnchek on your system. Executable binary for particular systems such
4172 as IBM PC or Macintosh, as available, can be obtained by anonymous ftp
4173 from ftp://ftp.dsm.fordham.edu/pub/ftnchek . Assistance in preparing
4174 such executable binary forms is welcome.
4175
4176 The nroff version of this document is named ftnchek.man. On UNIX sys‐
4177 tems, this file can be used as the man page, but actually it is a
4178 multi-purpose source file which is used to produce the other forms of
4179 the documentation. The cleaned-up man page document, created during
4180 installation of ftnchek, is named ftnchek.1. The distribution also
4181 includes a plain ASCII version named ftnchek.doc, a PostScript version
4182 named ftnchek.ps, an HTML version in directory html, and a VMS HELP
4183 version named ftnchek.hlp.
4184
4185 Information about the latest version and the status of the project can
4186 be obtained by visiting ftnchek's home page, http://www.dsm.ford‐
4187 ham.edu/~ftnchek . For further information and to report bugs, you may
4188 contact Dr. Robert Moniot, whose contact information can be found by a
4189 Web search for his name and Fordham University. (E-mail address is not
4190 provided here because it attracts unsolicited commercial e-mail, but it
4191 is easily constructed by combining his last name with the name of the
4192 university and the edu domain.)
4193
4195 dcl2inc(1L), dtoq(1L), dtos(1L), f77(1), fd2s(1L), fs2d(1L), ftnpp(1L),
4196 pfort(1L), qtod(1L), sf3(1L), stod(1L). xsf3(1L), xvcg(1L).
4197
4198
4199
4200 November 2004 FTNCHEK 3.3(1L)