|
|
 |
 |
 |
MAN page from openSUSE Leap 42 ftnchek-4beta_r132-19.3.x86_64.rpm
FTNCHEK 4.0Section: Misc. Reference Manual Pages (1L) Updated: July 2012 Index NAMEftnchek - Fortran program checker SYNOPSISftnchek[ -[ no] arguments[ =list]][ -[ no] array[ =list]] [ -[ no] brief][ -[ no] calltree[ =list]][ -[ no] check] [ -columns[ =num]][ -[ no] common[ =list]] [ -[ no] crossref[ =list]][ -[ no] declare] [ -[ no] division][ -errors[ =num]][ -[ no] extern] [ -[ no] f77[ =list]][ -[ no] f90[ =list]][ -[ no] f95[ =list]] [ -[ no] help][ -[ no] identifier-chars[ =list]] [ -include=str][ -[ no] intrinsic[ =list]][ -[ no] library] [ -[ no] list][ -[ no] makedcls[ =list]][ -[ no] mkhtml[ =list]] [ -module=str][ -[ no] novice][ -output=str] [ -pointersize[ =num]][ -[ no] portability[ =list]] [ -[ no] pretty[ =list]][ -[ no] project[ =list]] [ -[ no] pure][ -[ no] quiet][ -[ no] resources] [ -[ no] sixchar][ -[ no] sort][ -[ no] source[ =list]] [ -[ no] style[ =list]][ -[ no] symtab][ -[ no] truncation[ =list]] [ -[ no] type[ =list]][ -[ no] usage[ =list]][ -[ no] version] [ -wordsize[ =num]][ -wrap[ =num]][ files ...] DESCRIPTIONftnchek (short for Fortran checker)is designed to detect certain errors in aFortran program that a compiler usually does not.ftnchek is not primarilyintended to detect syntax errors. Its purpose is to assist the user in findingsemantic errors. Semantic errors are legal in the Fortran language but arewasteful or may cause incorrect operation. For example, variables which arenever used may indicate some omission in the program; uninitialized variablescontain garbage which may cause incorrect results to be calculated; andvariables which are not declared may not have the intended type.ftnchek isintended to assist users in the debugging of their Fortran program. It is notintended to catch all syntax errors. This is the function of the compiler.Prior to using ftnchek,the user should verify that the program compilescorrectly. The language accepted by ftnchek is Fortran 95 (with someexceptions noted in the section on limitations and extensions). This document first summarizes how to invoke ftnchek.That section should be read before beginning to use ftnchek.Later sections describe ftnchek'soptions in more detail, give an example of its use, and explainhow to interpret the output. The final sections mention the limitationsand known bugs inftnchek. INVOKING FTNCHEKftnchek isinvoked through a command of the form: $ ftnchek [-option -option ...] filename [filename ...]
The brackets indicate something which is optional. The bracketsthemselves are not actually typed. Here options are command-lineswitches or settings, which control the operation of the program and theamount of information that will be printed out. If no option isspecified, the default action is to print error messages, warnings,and informational messages, but not the program listing or symbol tables. Each option begins with the '-' character.(On VAX/VMS or MS-DOS systems you may use either '/' or '-'.)For the sake of conformity with a common convention, options canalso begin with '--'.The options are described at greater length in the next section. ftnchek options fall into two categories: switches, which are eithertrue or false, and settings, which have a numeric or string value. Thename of a switch is prefixed by 'no' or 'no-' to turn it off:e.g. -nopurewould turn off the warnings about impure functions. The 'no' prefixcan also be used with numeric settings, having the effect of turningoff the corresponding warnings.Settings that control lists of warnings have a special syntax discussedbelow.Only the first 3characters of an option name (not countingthe '-')need be provided.A colon may be used in place of an equals sign for numeric or string settingassignments; however, we show only the equals sign form below. The switches and settings which ftnchek currently recognizes arelisted below. For each option, the default is the value used if theoption is not explicitly specified, while the turn-on is the valueused if the option is given without assigning it a value. - -arguments=list
- Control warnings about subprogram type and argument mismatches.Default = turn-on = all.
- -array=list
- Control warnings in checking array arguments of subprograms.Default = turn-on = all.
- -brief
- Use shorter format for some error messages. Default = no.
- -calltree=list
- Produce subprogram call hierarchy in one of 3 formats:text call-tree, who-calls-who and VCG.Default = none, turn-on = tree,prune,sort.
If the -mkhtml option is invoked and tree is the appliedcalltree option, a file named CallTree.html, will be produceddepicting the tree in HTML format. - -check
- Perform checking. Default = yes.
- -columns=num
- Set maximum line length to num columns. (Beyondthis is ignored.) Turn-on = max = 9997. Default = 72.
- -common=list
- Set degree of strictness in checking COMMON blocks.Default = turn-on = all.
- -crossref=list
- Print cross-reference list of subprogram calls, label usage, and/orCOMMON block use. Default = none.
- -declare
- Print a list of all identifiers whose datatype is notexplicitly declared. Default = no.
- -division
- Warn wherever division is done (except division by aconstant). Default = no.
- -errors=num
- Set the maximum number of error messages per cascade. Default =turn-on = 3.
- -extern
- Warn if external subprograms which are invokedare never defined. Default = yes.
- -f77=list
- Control specific warnings about supported extensions to the Fortran 77Standard. Default = none, turn-on = all.
- -f90=list
- Control specific warnings about supported extensions to the Fortran 90Standard.Default = none, turn-on = all.
- -f95=list
- Control specific warnings about standard Fortran 77features that were deleted from the Fortran 95 Standard. Default =none, turn-on = all.
- -help
- Print command summary. Default = no.
- -identifier-chars=list
- Define non-alphanumeric characters that may be used in identifiers.Default = turn-on = dollar sign and underscore.
- -include=path
- Define a directory to search for INCLUDE files before searching in thesystem-wide directory.Cumulative. Default = turn-on = none.
- -intrinsic=list
- Control treatment of nonstandard intrinsic functions. Default =all except vms for Unix version, all except unixfor VMS version, all except unix and vms for otherversions. Turn-on = all.
- -library
- Begin library mode: do not warn about subprogramsin file that are defined but never used. Default = no.
- -list
- Print source listing of program. Default = no.
- -makedcls=list
- Prepare a file of declarations. The list specifies options forthe format of this file. Default = none, turn-on = declarations.
- -mkhtml=list
- Create individual HTML document files from ftnchek analysis and code comments.Usually you will also want to specify -call=tree to create theroot HTML file CallTree.html.Default = none, turn-on = documents.
- -module=path
- Define a directory into which to write module files, and alsoto search for module files referenced in USE statements.Default = directory of source file, turn-on = none.
- -novice
- Give output suitable for novice users. Default = yes.Advanced users will want to turn this off to give output suitable forparsing by IDEs and context-aware editors like emacs.
- -output=filename
- Send output to the given file.Default and turn-on sends output to the screen. (Default filenameextension is .lis).
- -pointersize=num
- Set the size of ``Cray pointer'' variables to num bytes. Min =1, max = 16. Default = turn-on = 4
- -portability=list
- Warn about non-portable usages. Default = none, turn-on = all.
- -pretty=list
- Give warnings for possibly misleading appearanceof source code. Default = turn-on = all.
- -project=list
- Create project file (see explanation below). Default =no.
- -pure
- Assume functions are pure, i.e. have no side effects.Default = yes.
- -quiet
- Produce less verbose output. Default = no.
- -resources
- Print amount of resources used in analyzing the program.Default = no.
- -sixchar
- List any variable names which clash at 6 characters length.Default = no.
- -sort
- Print list of subprograms sorted in prerequisite order.Default = no.
- -source=list
- Select source formatting options: fixed or free form, DEC Fortrantab-formatted lines, VMS-style INCLUDE statement,UNIX-style backslash escape sequences,and implicit typing of parameters. Default = none (fixed or free forminferred from file extension), turn-on = all.
- -style=list
- Produce extra-picky warnings about obsolescent or old-fashionedprogramming constructions. Default = none, turn-on = all.
- -symtab
- Print symbol table and label table for each subprogram. Default = no.
- -truncation=list
- Check for possible loss of accuracy by truncation.Default = turn-on = all.
- -type=list
- Check for issues related to user-defined types.Default = turn-on = all.
- -usage=list
- Control warnings about unused or uninitialized variables, commonblocks, etc. Default = turn-on = all.
- -version
- Print version number. Default = no.
- -wordsize=num
- Set the default word size for numericquantities to num bytes. Default = turn-on = 4 bytes.
- -wrap=num
- Set output column at which to wrap long error messages andwarnings to the next line. If set to 0, turn off wrapping. Default =turn-on = 79.
When more than one option is used, they should be separated by a blankspace, except on systems such as VMS where options begin with slash ( / ).No blank spaces may be placed around the equals sign ( = ) in a setting.ftnchek "?"will produce a command summary listing all options and settings. For settings that take a list of keywords, namely-arguments,-array,-calltree,-common,-crossref,-f77,-f90,-f95,-intrinsic,-makedcls,-mkhtml,-portability,-pretty,-project,-source,-style,-truncation,-type,and-usage,the list consists of keywordsseparated by commas or colons.If the list of keywords is omitted, theeffect is to set the option to its turn-on value (same as ``all'' in mostcases).Also, if thelist is omitted, the setting name can be prefixed with no orno- toturn off all the options it controls. For example, -f77 turnson all warnings about nonstandard constructions, while-nof77 turns them all off. Three special keywords are: - help
- Print out all the option keywords controlled by the setting,with a brief explanation of their meanings.This keyword cannot be given in a list with other keywords.
- all
- Set all options. This turns on all options controlled by the setting.
- none
- Clear all options. This turns off all options controlled by the setting.
For example, -f77=help gives a list of all the keywordscontrolled by the -f77 option, -f77=all turns them allon, and -f77=all turns them all off.These three special keywords must be given in full. For all otherkeywords, only as many letters of the keyword as are necessary toidentify it unambiguously need be given, or a wildcard patternmay be used. Including a keyword in thelist turns the corresponding option on.For example, -f77=intrinsic wouldturn on only the warnings about use of nonstandard intrinsic functions.Prefixing a keyword by no- turns its option off.For example,-pretty=no-long-line turns off warnings about linesexceeding 72 columns in length while leaving all other warnings aboutmisleading appearance in effect.If a setting has default none, you can turn on all optionsexcept one or two by using all first.For example,-f77=all,no-intrinsic enables warnings about all nonstandardextensions except intrinsic functions.If a setting has default all, you can turn off all warningsexcept one or two by using none first.For example,-truncation=none,demotion would turn off all precision relatedwarnings except about demotions.Wildcard patterns contain an asterisk to stand for any string ofcharacters. If a wildcard pattern is used, all the warnings thatmatch it are affected. If no- is prefixed to the pattern, allthe matching warnings are turned off, otherwise they are all turnedon. The minimum unambiguous length rule does not apply to wildcardmatching. For example, use -usage=no-*var* to turn offall warnings relating to variable usage (both local and common).(Unix users may need toquote any options containing wildcards in order to prevent the shellfrom attempting to expand them.)Wildcards are recognized only in lists of warning keywords, not in thetop-level options themselves. When ftnchek starts up, it looks for environment variablesand also for a preferences file.Any options defined in the environment or in the preferences file areused as defaults in place of the built-in defaults. They areover-ridden by any command line options.See the section on changing the defaults for details about theenvironment options and the preferences file. When giving a name of an input file, the extension is optional. If noextension is given, ftnchek will first look for a project filewith extension .prj, and will use that if it exists. If not, thenftnchek will look for a Fortran source filewith the extension .for for VMS systems, .f for UNIX systems.The default source format for files with extension .for or .fis fixed format. If the input file is in free format, use extension.f90 or .f95 (or specify -source=free on thecommand line).More than one file name can be given to ftnchek,and it will process theprogram units in all files as if they were in a single file. Wildcards are allowed in the specification of filenames on the commandline for the VMS and MS-DOS versions,as also of course under UNIX and any other system that performswildcard expansion in the command processor. If no filename is given, ftnchek will read input from thestandard input. OPTIONSThis section provides a more detailed discussion of ftnchekcommand-line options. Options and filenames may be interspersed on acommand line. Most options are positional: each option remains ineffect from the point it isencountered until it is overridden by a later change. Thus forexample, the listing may be suppressed for some files and not forothers. Exceptions are: the -intrinsic, -pointersize,and -wordsize settings, which cannot bechanged once processing of input files has started;the -arguments, -array, -calltree, -common, -crossref, -extern, -resources,and -sortoptions, where the action depends only on the value ofthe option after the processing of input files is finished;and the -include setting, which is cumulative. The option names in the following list are in alphabetical order. - -arguments=list
- Controls warnings aboutmismatches between actual and dummy subprogram arguments, and alsoabout mismatches between expected and actual subprogram type. (An actualargument is an argument passed to the subprogram by the caller; adummy argument is an argument received by the subprogram.)By default, all warnings are turned on.
The list consists of keywords separated by commas or colons.Since all these warnings are on by default, include a keyword prefixed byno- to turn off a particular warning.There are three special keywords: all to turn on all thewarnings about arguments, none to turn them alloff, and help to print the list of all the keywords with a briefexplanation of each.If list is omitted, -arguments is equivalent to-arguments=all, and -noarguments is equivalent to-arguments=none.The warning keywords with their meanings are as follows: - arrayness:
- warn about inconsistent use of arguments that are arrays.These warnings can be further controlled by the -array option.
- type:
- warn about dummy arguments of a different data type from the actual arguments.
- function-type:
- warn if the invocation assumes the function's return value is adifferent type than it actually is. Also warns if a function iscalled as a subroutine, or vice-versa.
- number:
- warn about invoking a subprogram with a different number of argumentsthan the subprogram expects.
For compatibility with previous versions of ftnchek, a numericform of this setting is also accepted: the list is replaced by anumber from 0 to 3. A value of 0 turns all the warnings off,1 turns on only number, 2 turns on allexcept number, and 3 turns all the warnings on. This setting does not apply to checking invocationsof intrinsic functions or statement functions, which canonly be turned off by the -nocheck option. See also: -array, -library, -usage.
- -array=list
- Controls the degree of strictness in checkingagreement between actual and dummy subprogram arguments that are arrays.The warnings controlled by this setting are for constructions that mightlegitimately be used by a knowledgeable programmer, but that oftenindicate programming errors.By default, all warnings are turned on.
The list consists of keywords separated by commas or colons.Since all these warnings are on by default, include a keyword prefixed byno- to turn off a particular warning.There are three special keywords: all to turn on all thewarnings about array arguments, none to turn them alloff, and help to print the list of all the keywords with a briefexplanation of each.If list is omitted, -array is equivalent to-array=all, and -noarray is equivalent to-array=none.The warning keywords with their meanings are as follows: - dimensions:
- warn if the arguments differ in their number of dimensions,or if the actual argument is an array element while the dummy argumentis a whole array.
- size:
- warn if both arguments are arrays, but they differ in numberof elements.
For compatibility with previous versions of ftnchek, a numericform of this setting is also accepted: the list is replaced by anumber from 0 to 3. A value of 0 turns all the warnings off,1 turns on only dimensions, 2 turns on onlysize, and 3 turns all the warnings on. Note:A warning is always given regardless of this setting if the actualargument is an array while the dummy argument is a scalar variable, orif the actual argument is a scalar variable or expression while thedummy argument is an array. These cases are seldom intentional.(To turn off even these warnings, use -arguments=no-arrayness.)No warning is ever given if the actual argument is an arrayelement while the dummy argument is a scalar variable.Variable-dimensioned arrays and arrays dimensioned with 1 or asterisk match anynumber of array elements.There is no check of whether multi-dimensional arrays agree in thesize of each dimension separately. See also:-arguments, -library, -usage.
- -brief
- Selects a shorter format for some warning messages. At present, theonly warnings controlled by this flag are those that are printed atthe end of processing each subprogram. These include warnings aboutvariables that are set but not used or used before set, variable namesthat do not conform to the Fortran 77 standard, etc. (These warningsmay be suppressed entirely depending on other flags, such as the-usage or -f77 flags.) In the default format eachvariable is listed on a separate line, along with the line numberwhere the variable is declared, set or used, according to the natureof the warning. The briefer format simply lists all variables towhich the warning applies, with up to 4 variables per line.
See also: -quiet.
- -calltree=list
- Causes ftnchek to print out the call structure ofthe complete program.NOTE: at this time, this option is not workingcorrectly for programs containing or using module subprograms.
The list consists of keywords separated by commas or colons.There are two special keywords: none to turn off all theoptions, andhelp to print the list of all the keywords with a briefexplanation of each. (The keyword all turns on all theoptions, but should not normally be used since only one format shouldbe specified.)If list is omitted, -calltree is equivalent to-calltree=tree, and -nocalltree is equivalent to-calltree=none.By default no call graph is printed. If the -mkhtml option is invoked and tree is the appliedcalltree option, a file named CallTree.html, will also be produceddepicting the tree in HTML format. This file is useful as a startingpoint for browsing the HTML files describing each component of theprogram. The keywords which control which format is used are as follows: - tree:
- produce the call graph in tree format.
- reference:
- produce the call graph in who-calls-who format.
- vcg:
- produce the call graph in VCG format.
Only one of the formats tree, reference, or vcg maybe specified. The following keywords control options affecting the output: - prune:
- prune repeated subtrees (applicable only with tree). Thisthe default.
- sort:
- sort children of each routine into alphabetical order. This is the default.
For tree format, the call graph is printed outstarting from the main program, which is listed on the first line atthe left margin. Then on the following lines, each routine called bythe main program is listed, indented a few spaces, followed by thesubtree starting at that routine. In the default mode,if a routine is called by more than one other routine,its call subtree is printed only the first time it is encountered.Later calls give only the routine name and the notice ``(see above)''.To have the subtree printed for each occurrence of the routine,use option no-prune. Note that the call tree will be incomplete if any of the input filesare project files containing more than one program unitthat were created in -library mode. See thediscussion of project files below. Technical points: Each list of routines called by a given routine isprinted in alphabetical order unless the no-sort option is given.If multiple main programs are found, the call tree of each is printedseparately.If no main program is found, a report to that effect is printed out,and the call trees of any top-level non-library routines are printed.See the discussionof the -library flag. For reference format a who-calls-who table is printed.This table lists each subprogram followed by a list of theroutines it calls. The reference list omits routinescalled by unused library program units. Thus it contains the sameinformation as for the call-tree format, namely the hierarchy ofsubprogram calls, but printed in a different way. This prints outa breadth-first traversal of the call tree whereas -calltree=tree printsout a depth-first traversal. For vcg format the call tree is producedin the form of a VCG graph description. Thisdescription is written to a separate file, with the same stem as thefile containing the main program, and suffix.vcg.This file is able to be given directly toxvcg(1L)to visualize the call graph.(If input is from the standard input, then the graph description issent to standard output.) The VCG description as created is more complex than it need be. VCG allowsgraphs and nested subgraphs: each subroutine is created as asubgraph nested inside its calling routines. This allows you tointeractively display subgraphs or summarise them. The-calltree=vcgoption forftnchekwas written by Dr. Philip Rubini of Cranfield University, UK. xvcg(1L) is a graph visualisation tool which runs under the X windows system.It is freely available from ftp.cs.uni-sb.de. It was written by G. Sanderof the University of Saarland, Germany. For compatibility with previous versions of ftnchek, a numericform of this setting is also accepted: the list is replaced by anumber from 0 to 15. This number is formed from 1 fortree format, 2 for reference format, or 3 for vcgformat, plus 4 for no-prune, and 8 for no-sort. See also:-crossref, -library, -sort,-symtab.
- -check
- This switch is provided so that errors and warning messages can beturned off when ftnchek is used for purposes other than findingbugs, such as making declarations or printing the call tree. It ispositional, so after turning all checks off, selected checks can beturned back on. The effect of -nocheck is to put all switches,numeric settings, and settings controlling lists of warningsto their turn-off values, as if they had all beenspecified with the -no prefix.NOTE: in ftnchek version 4, many new warnings were introduced,and some may not have been put under the control of this switch. Weare working on this.
Switches and settings that specifyoptions and modes of operation, rather than controlling warnings, areunaffected.These are-calltree,-columns, -crossref,-include, -intrinsic,-library, -list,-makedcls,-module,-novice,-output,-pointersize, -project,-quiet,-resources,-sort, -source, -symtab,-version,-wordsize,and-wrap.Default = yes. Parse errors (syntax errors due to unrecognized or malformedstatements) are not suppressed by this switch, since the results maybe incorrect if ftnchek has not parsed the program correctly. There are some miscellaneous errors and warning messages that are notcontrolled by any other switch, and so can be turned off only by thisswitch. Note that using -check following -nocheck onlyhas the effect of turning these special warnings back on, and does notrestore all the checks it turned off. These warnings include: - o
- Program unit contains no executable statements.
- o
- In free source form, missing space where space is required(e.g. between a keyword and an identifier) or spacepresent where none is allowed (e.g. within an identifier).
- o
- Zero or negative length specification in a data type declaration of theform type*len.
- o
- Invalid operand(s) in an expression.
- o
- Array assigned to scalar.
- o
- Type mismatch between DO index and bounds.
- o
- Undefined common block declared in SAVE statement.
- o
- Intrinsic function explicitly declared with an incompatible type.
- o
- Unknown intrinsic function explicitly declared in anINTRINSIC statement.
- o
- Intrinsic function passed as a subprogram argument is not declaredin an INTRINSIC statement.
- o
- Intrinsic function or statement function invoked incorrectly.
- o
- Function does not set return value prior to RETURN statement.
- o
- Parameter constant value not evaluated (this is ftnchek's fault,and it is just informing you of the fact).
- o
- Entry point of a subprogram is later used as a different subprogram'sname.
- o
- Unknown keyword used in an I/O statement.
- o
- Illegal label reference (e.g. GOTO refers to a non-executablestatement; I/O statement refers to a non-format statement).
See also: -errors.
- -columns=num
- Set maximum fixed-form statement line length to num columns.(Beyond this is ignored.)This setting is provided to allow checking of programs which mayviolate the Fortran standard limit of 72 columns for the length of astatement line in fixed source format. According tothe standard, all characters past column 72 are ignored.If this setting is used when the -f77=long-line option is in effect, awarning will be given for any lines in which characters past column 72are processed.Turn-on = max = 9997. Default = 72.
This setting does not suppress warnings about the presence ofcharacters beyond column 72.To process code with meaningful program text beyond column 72, usethis setting and be sure the -f77 long-line option is off.To process code with sequence numbers in columns 73 to 80, leave thethe columns setting at the default value and use the-pretty=no-long-line flag. See also: -f77, -pretty.
- -common=list
- This setting controls the strictness ofchecking of COMMON blocks.By default, all warnings except name and volatile are turned on.
The list consists of keywords separated by commas or colons.Since most of these warnings are on by default, include a keyword prefixed byno- to turn off a particular warning.There are three special keywords: all to turn on all thewarnings, none to turn them alloff, and help to print the list of all the keywords with a briefexplanation of each.If list is omitted, -common is equivalent to-common=all,and -nocommon is equivalent to-common=none.The warning keywords with their meanings are as follows: - dimensions:
- corresponding arrays in each declaration of a block mustagree in size and number of dimensions. This option only has an effectwhen used together with exact.
- exact:
- the comparison of two blocks is done variable-by-variable rather thansimply requiring agreement between corresponding storage locations.Use this if all declarations of a given COMMON block are supposed to beidentical, which is a good programming practice.
- length:
- warn if different declarations of the same block are not equal intotal length.The Fortran 77 Standard requires each named common block, but notblank common, to bethe same length in all program units of the program.
- name:
- warn if corresponding variables in different declarations of the sameblock differ in name (ignoring variations of case).This option only has an effect when used together with exact.It can be useful when porting old code to Fortran 90, putting variabledeclarations into modules, when it becomes essential thatall subprograms use the same names for corresponding variables.To prevent cascades, this warning is only given for one pair ofdeclarations of a given block per run.
- type:
- in each declaration of a given COMMON block,corresponding memory locations (words or bytes) must agree in data type.If used together with exact, this will require thatcorresponding variables agree in data type.
- volatile:
- Assume that COMMON blocks are volatile.
Many Fortran programmers assume that variables, whetherlocal or in COMMON, are static, i.e. thatonce assigned a value, they retain that value permanently untilassigned a different value by the program. However, in fact theFortran 77 Standard does not require this to be the case.Local variables maybecome undefined between activations of a subprogram in which they aredeclared. Similarly, named COMMON blocks may become undefined if no subprogramin which they are declared is active. (The technical term forentities with this behavior is ``automatic'',but ftnchek uses the word ``volatile'' since itis clearer to the nonspecialist.) Only blank (unnamed) COMMON andCOMMON blocks declaredin a SAVE statement, ordeclared in the main program or in a block data subprogram remaindefined as long as the program is running. Variables and COMMONblocks that can become undefined at some point are called volatile. If the -common=volatile flag is turned on,ftnchek will warn you if it findsa volatile COMMON block. If, at the same time, the-usage=com-block-volatile option is turned on (which is the default),ftnchek will try to check whethersuch a block can lose its defined status between activations of thesubprogram where it is declared. ftnchek does not do a very good job ofthis: the rule used is to see whether the block is declared in twoseparated subtrees of the call tree. For instance, this would be thecase if two program units, both called from the main program, shared avolatile COMMON block. A block can also become undefined between twosuccessive calls of the same subprogram, but ftnchek is not smartenough to tell whether a subprogram can be called more than once, sothis case is not checked for. The -common=volatile flag does not affect the way ftnchekchecks the usage of local variables. For compatibility with previous versions of ftnchek, a numericform of this setting is also accepted: the list is replaced by anumber from 0 to 3. A value of 0 turns all the warnings off,1 or greater turns on type, 2 or greater turns on length, and3 turns on dimensions and exact also. The numeric formcannot turn on the volatile option. See also: -library, -usage.
- -crossref=list
- Prints cross-reference tables. Default = none.NOTE: at this time, this option is not workingcorrectly for module subprograms.
The list consists of keywords separated by commas or colons.The keywords with their meanings are as follows: - calls:
- table lists each subprogram followed by a list of routines that callit. This listing omits library program units that are not in the call treeof the main program. The list is alphabetized.
- common:
- table lists each COMMON block followed by a list of the routines thataccess it. These listed routines are those in which some variables inthe COMMON block are accessed, not simply those routines that declarethe block. (To find out what routines declare a COMMON block but donot use it, see the -usage flag.)
- labels:
- table lists each label followed by a list of all references to it. Alabel reference is denoted by the line number and statement type ofthe referring statement. The label list is in sequential order. Thereferences are listed in the order they are encountered in the program.
See also: -calltree, -sort,-symtab.
- -declare
- If this flag is set, all identifiers whose datatype isnot declared in each program unit will be listed. This flag is useful forhelping to find misspelled variable names, etc. The same listing willbe given if the program unit contains an IMPLICIT NONE statement.Default = no.
See also: -sixchar, -usage.
- -division
- This switch is provided to help users spot potentialdivision by zero problems. If this switch is selected, every divisionexcept by a constant will be flagged. (It is assumed that the user isintelligent enough not to divide by a constant which is equal to zero!)Default = no.
See also: -portability, -truncation.
- -errors=num
- Set the maximum number of error messages in a ``cascade''.During checking of agreement of subprogramarguments, common block declarations, and so forth, sometimes a singlecase will generate a long string of warnings. Often this simplyindicates some other cause than a genuine item-by-item mismatch, suchas forexample a variable missing from one list. So in such casesftnchek stops printing the warnings after the cascade limit isreached, and the trailer ``etc...'' is printed to indicate that therewere more errors not printed. If you think that these warnings arelikely to be genuine, use this setting to see more of them.Turn-on = default = 3, max = 999. A value of 0 means no limit.
This setting does not set an overall limit on the number of errormessages printed, only the number printed in any one cascade. Mosttypes of warnings and error messages are not subject to the cascadeeffect and so are not affected by this setting. To turn off warningsgenerally, use the individual warning control options or the-nocheck option. See also: -check.
- -extern
- Causes ftnchek to report whether any subprogramsinvoked by the program are never defined.Ordinarily, if ftnchek is being run on a complete program, eachsubprogram other than the intrinsic functions should be definedsomewhere. Turn off this switch if you just want tocheck a subset of files which form part of a larger complete program.Subprogram arguments will still bechecked for correctness. Default = yes.
The -extern flag is now superseded by the-usage=ext-undefined option. For the sake of convenience, the-extern flag is retained, so that -noextern isequivalent to -usage=no-ext-undefined option. The-extern switch may be retired eventually. See also: -library.
- -f77=list
- Use this setting to catch language extensions which violatethe Fortran 77 Standard. Such extensions may cause your program notto be portable. Examples include the use of underscores in variablenames; variable names longer than six characters; statement lineslonger than 72 characters; and nonstandard statements such as theDO ... ENDDO structure. ftnchek does not report onthe use of lowercase letters.By default, all warnings are turned off.
This setting provides detailed control over the warnings aboutvendor extensions to the Fortran 77 Standard that are acceptedby ftnchek but were notadopted in Fortran 90. It also provides control over warnings aboutsyntax features that were introduced in Fortran 90.(Further details about the extensions themselves are given below in thesection on Extensions.)The listconsists of keywords separated by commas or colons.There are three special keywords: all to turn on all thewarnings about nonstandard extensions, none to turn them alloff, and help to print the list of all the keywords with a briefexplanation of each.If list is omitted, -f77 is equivalent to-f77=all, and -nof77 is equivalent to-f77=none.The warning keywords with their meanings are as follows: - accept-type:
- ACCEPT and TYPE I/O statements.
- backslash:
- Unix backslash escape in strings. This warning will be given only ifthe -source=unix-backslash setting is specified to causethe escape interpretation of backslash..
- byte:
- BYTE data type declaration.
- common-subprog-name:
- Common block and subprogram having the same name.
- continuation:
- More than 19 successive continuation lines.
- cpp:
- Unix C preprocessor directives in the source code.
- cray-pointer:
- ``Cray pointer'' syntax.
- d-comment:
- Debugging comments starting with D in the source code.
- dec-tab:
- DEC Fortran style tab-formatted source code. This warning will begiven only if the -source=dec-tab setting is specified to causeinterpretation of tabs in this style.
- double-complex:
- Double precision complex datatype.
- f90:
- Any non-Fortran 77 syntax features that are standard Fortran 90.There is no provision for controlling warnings about these featuresindividually, because there are so many. NOTE: since support for fullFortran 90 has only recently been added, our attention was focused onimplementing support for the new syntax. Warnings under this optionfor some features may not have been added yet, so Fortran 77 standard conformance checking is incomplete at this time.We will tighten it up as time permits. Also, no warning is givenabout the use of lowercase characters.
- format-dollarsign:
- Dollar sign control code in FORMAT statements.
- format-edit-descr:
- Nonstandard edit descriptors in FORMAT statements.
- function-noparen:
- Function definition without parentheses.
- initializer:
- Nonstandard initializer that mixes type declaration with aninitialization using DATA-statement syntax, e.g.INTEGER N / 10 /.Warnings about Fortran 90 standard initializers, e.g. INTEGER:: N=10 arecontrolled by -f77=f90.
- internal-namelist-io:
- Namelist-directed I/O to or from an internal file.List-directed I/O (format *) is also nonstandard, but it ispermitted in Fortran 90, so the warning about it is controlledby -f77=f90.
- intrinsic:
- Nonstandard intrinsic functions that were not adopted in Fortran 90.
- io-keywords:
- Nonstandard keywords used in I/O statements. These fall into threegroups. The first group includes keywords that are accepted inFortran 90:
| ACTION | PAD | READWRITE
| | ADVANCE | POSITION | SIZE
| | DELIM | READ | WRITE
| | EOR | |
| The second group comprises the following VMS Fortran keywords:| BLOCKSIZE | EXTENDSIZE | READONLY
| | BUFFERCOUNT | INITIALSIZE | RECORDSIZE
| | CARRIAGECONTROL | MAXREC | RECORDTYPE
| | DEFAULTFILE | NAME (in OPEN) | SHARED
| | DISP | NOSPANBLOCK | TYPE
| | DISPOSE | ORGANIZATION |
| (The keyword NAME is standard only in the INQUIREstatement.)The third group consists of the following IBM/MVS keyword:Warnings about the first group are controlled by -f77=f90,not this flag.This flag also controls a warning about use of ACCESS='APPEND',which is accepted by some compilers. The value of 'APPEND' isnot valid for any I/O specifier in standard Fortran 77, and in Fortran90 'APPEND' should be used as a value of the POSITIONspecifier, not ACCESS. - long-line:
- Statements in fixed form with meaningful code past 72 columns. This warning isgiven only if the -columns setting has been used to increasethe statement field width.
- mixed-expr:
- Nonstandard type combinations in expressions, for example DOUBLEPRECISION with COMPLEX, assigning hollerith to integer,logical operations on integers.
- name-dollarsign:
- Dollar sign or other nonstandard character used as a character in identifiers.
- param-implicit-type:
- Implicit typing of a parameter by the data type of the value assigned.This warning can only occur if implicit parameter typing has beenturned on by the -source=param-implicit-type option, orif the PARAMETER statement is of the nonstandard form withoutparentheses. If this option is turned on,then any instances where implicit parameter typing occurs will bewarned about.If you want to be warned only in those instanceswhere the implicit data type differs from the default type, use-portability=param-implicit-type instead. According to the Fortran77 standard, the data type of a parameter is given by the same rulesas for a variable, and if necessary a type conversion is done when thevalue is assigned.
- param-intrinsic:
- Intrinsic function or exponentiation by a real used to define the valueof a PARAMETER definition. Note that in Fortran 90 therestriction on intrinsic functions has been relaxed somewhat, while therestriction on exponentiation remains. In a future release we plan toprovide a flag that will separate control over these two categories ofwarnings.
- param-noparen:
- PARAMETER statement without parentheses. The user should beaware that the semantics of this form of the statement differs fromthat of the standard form: in this form, the parameter takes its datatype from the value assigned, rather than having its default data typebased on the first letter of the parameter name. (This form of thePARAMETER statement was introduced by DEC before the Fortran 77standard was defined, and should be avoided.)
- quad-constant:
- Quad precision real constants, e.g. of the form 1.23Q4.
- statement-order:
- Statements out of the sequence mandated by the Standard. The allowedsequence is illustrated in Table 1 in the section on Interpreting theOutput.
- typeless-constant:
- Typeless constants, for example Z'19AF'. Constants of this formare now acceptable in Fortran 90, provided the initial letter isB, O, or Z. Some vendor versions of Fortranallow constants with the initial letter X, or with the letter atthe end of the string instead of the beginning. This option controlswarnings only about the forms that are not standard Fortran 90. Forwarnings about the others, use -f77=f90.
- This flag also controls warnings if the constants have Fortran 90standard forms but are used outside of a DATA statement.
- type-size:
- Type declarations specifying a size, for example REAL*8.
- variable-format:
- Variable repeat specification or field size in FORMAT. Theseare of the form < expr >.
See also: -f90, -f95, -portability,-pretty, -style, -wordsize.
- -f90=list
- This setting provides detailed control over the warnings aboutsupported extensions to the Fortran 77 Standard that were not adoptedas part of the Fortran 90 Standard. Note that ftnchek does notsupport the full Fortran 90 language. However, it does support somecommon extensions to Fortran 77 that were prevalent before Fortran 90was defined. Some of these extensions became part of the Fortran 90Standard, but others did not. The -f90 setting warns onlyabout the latter. That is, this flag covers things that are neither legalFortran 77 nor legal Fortran 90. Therefore, the warnings controlledby this flag are basically a subset of the warnings controlled by-f77. There are a few cases, described below, where thecircumstances in which the warning is given are slightly different forthe two flags.
The listconsists of keywords separated by commas or colons.There are three special keywords: all to turn on all thewarnings about nonstandard extensions, none to turn them alloff, and help to print the list of all the keywords with a briefexplanation of each.If list is omitted, -f90 is equivalent to-f90=all, and -nof90 is equivalent to-f90=none. The option keywords for this setting are the same as for -f77, exceptingf90 and param-intrinsic. (An option for checking F90parameter declarations is in the works.)Most keywords have identical meanings for -f90 as for-f77. Refer to the explanations under -f77. The keywords which differ somewhat from the corresponding-f77 keywords are as follows. - continuation:
- The limit on the number of continuation lines for a statement infixed source form is thesame, namely 19, in Fortran 90 as in Fortran 77. For freesource form the limit is 39 continuation lines, and a line containinga continuation mark cannot be otherwise empty or contain only a comment.
- intrinsic:
- This is the same as for -f77 except for the intrinsicfunctions defined in MIL-STD 1753, which are all included in Fortran90, and so are not warned about. (See -intrinsic for a list.)
- long-line:
- Although the Fortran 90 Standard allows lines longer than 72characters in free source form, this restriction still applies to fixedsource form. In free source form the line length limit is 132 characters.
- mixed-expr:
- This is the same as for -f77 except for expressions mixingextended precision real with complex data types, which are permittedin Fortran 90.
- statement-order:
- This is similar to the corresponding -f77 warning, but appliesthe somewhat looser restrictions on statement order of theFortran 90 Standard. In particular, Fortran 90 allows DATAstatements and statement-function definitions to be intermixed withspecification statements.
See also: -f77, -f95, -portability,-pretty, -style, -wordsize.
- -f95=list
- This setting provides detailed control over warnings about standard Fortran 77features that were deleted from the Fortran 95 Standard. Unlike the-f77 and -f90 settings, these warnings apply to syntaxwhich is legal Fortran 77. However, since these features have been deletedfrom the Standard, it is possible that programs containingthem will be unacceptable to some newer compilers.
Note that this setting does not specify checking conformance tothe Fortran 95 standard, other than checking for these deletedfeatures. In future we plan to provide standard conformance checkingfor Fortran 95. The listconsists of keywords separated by commas or colons.There are three special keywords: all to turn on all thewarnings about nonstandard extensions, none to turn them alloff, and help to print the list of all the keywords with a briefexplanation of each.If list is omitted, -f95 is equivalent to-f95=all, and -nof95 is equivalent to-f95=none.The warning keywords with their meanings are as follows. - real-do:
- A DO variable of any real numeric type.
- pause:
- The PAUSE statement.
- assign:
- The ASSIGN statement, assigned GOTO, or assigned format.
- h-edit:
- The H edit descriptor in a format.
There is one other Fortran 77 syntax feature that was deleted inFortran 95, namely branching to an ENDIF from outside theIF block. However, ftnchek is unable to analyze programflow, and so it does not provide a warning for this. See also: -f77, -f90, -portability,-pretty, -style, -wordsize.
- -help
- Prints a list of all the command-line options with ashort description of each along with its default value.This command is identical in function tothe ``?''argument. Default = no.
The help listing also prints the version number and patch level offtnchek and a copyright notice. Note: the ``default'' values printed in square brackets in the help listingare, strictly speaking, not the built-in defaults but the currentvalues after any environment options and any command-lineoptions in a preferences file or preceding the -help option have been processed. See also: -novice, -version, and setting=help option ofall settings that take a list of keywords.
- -identifier-chars=list
- Define non-standard characters that may be used in identifiers.According to the Fortran 90 standard, identifiers may contain onlyalphanumeric characters or the underscore.By default, ftnchek also accepts the dollar sign as a character in identifier names.The characters inthe list replace whatever set of accepted non-standard characterswas previously in effect. Thus, if dollar sign is notincluded in the list, it loses its status as an acceptable character.
The purpose of this option is to enable ftnchek to correctly parse source filescontaining non-standard identifier names that may be needed, forexample, to access certain operating system services. See the sectionon Limitations and Extensions for the treatment of identifierscontaining these characters in implicit typing.Warnings about use of these non-standard characters will still begiven if the -f77=name-dollarsign or-f90=name-dollarsign option is given. Using -noidentifer-chars turns off acceptance ofnon-standard characters entirely. See also: -source.
- -include=path
- Specifies a directory to be searched for filesspecified by INCLUDE statements. Unlike other command-lineoptions, this setting is cumulative; that is, if it is given more thanonce on the command line, all the directories so specified are placedon a list that will be searched in the same order as they are given.The order in which ftnchek searches for a file to be included is:the current source-file directory; the directory specified byenvironmentvariable FTNCHEK_INCLUDE if any;the directories specified by any -include options;the directory specified by environment variable INCLUDE;and finally ina standard system-wide directory(/usr/include for UNIX, SYS$LIBRARY for VMS,and \includefor MSDOS).
When a USE statement is encountered, if the module it referencesis not found in the source-file directory or the directory specifiedwith -module, then the above list of locations is alsosearched. See also: -f77, -module, -source.
- -intrinsic=list
- Controls whether ftnchek recognizes certain nonstandardintrinsic functions as intrinsic.The list consists of keywordsseparated by commas or colons. Some of the keywords control whetherto recognize certain groups of functions, and other keywordscontrol the expected syntax for invokingsome nonstandard intrinsics.Include a keyword to turn on recognition of the correspondingset of intrinsics or to allow the corresponding syntax. Include akeyword prefixed byno- to turn off that recognition.
There are three special keywords: all turns on recognition ofall the nonstandard intrinsics (listed below) and accepts either syntax forthose that have variations.Use none to turn off recognition of all nonstandard intrinsicsexcept those noted below.Use help to print the list of all the keywords with a briefexplanation of each.If list is omitted, -intrinsic is equivalent to-intrinsic=all, and -nointrinsic is equivalent to-intrinsic=none. The nonstandard intrinsic functions needed to support the nonstandardextended precision data types (double complex and quad precision) arealways recognized. The intrinsics for the double complex data type are: | CDABS | CDSQRT | DREAL | ZLOG
| | CDCOS | DCMPLX | IMAG | ZSIN
| | CDEXP | DCONJG | ZABS | ZSQRT
| | CDLOG | DIMAG | ZEXP | ZCOS
| | CDSIN | | |
| An intrinsic for converting integer directly to double precision is:The intrinsics for the quad precision and quad complex types are:| CQABS | QARCOS | QEXT | QNINT
| | CQCOS | QARSIN | QEXTD | QPROD
| | CQEXP | QATAN | QFLOAT | QREAL
| | CQLOG | QATAN2 | QIMAG | QSIGN
| | CQSIN | QCMPLX | QINT | QSIN
| | CQSQRT | QCONJG | QLOG | QSINH
| | DBLEQ | QCOS | QLOG10 | QSQRT
| | IQINT | QCOSH | QMAX1 | QTAN
| | IQNINT | QDIM | QMIN1 | QTANH
| | QABS | QEXP | QMOD | SNGLQ
| The keywords controlling recognition of other nonstandard intrinsicfunctions are as follows:- extra:
- recognize the following commonly available nonstandard intrinsics
- unix:
- recognize these common Unix-specific intrinsic functions:
| ABORT | GMTIME | LTIME | SRAND
| | AND | IARGC | OR | SYSTEM
| | GETARG | IRAND | RAND | TIME
| | GETENV | LSHIFT | RSHIFT | XOR
|
- vms:
- recognize these common VMS-specific intrinsic functions:
| DATE | IDATE | SECNDS | TIME
| | ERRSNS | RAN | SIZEOF |
|
- iargc-no-argument:
- specify that IARGC may be invoked with no arguments.
- iargc-one-argument:
- specify that IARGC may be invoked with one argument.
- rand-no-argument:
- specify that RAND and IRAND may be invoked with noarguments.
- rand-one-argument:
- specify that RAND and IRAND may be invoked with oneargument.
The no-argument and one-argument keywords work asfollows: turning the option on causes ftnchek to accept thecorresponding syntax for invocation of the function, without excludingthe possibility of the alternative syntax. Turning the option offcauses the corresponding syntax not to be accepted. If both optionsare turned on at once (the default), then either syntax is accepted.Turning both options off at once would not be meaningful.These options have no effect if recognition of Unix intrinsics hasbeen turned off. Note that this setting does not control whether non-standard warningsare issued about these functions. It controls whether thefunctions are assumed to be intrinsic or not, which determines how theirusage is checked. When functions in any of these sets areincluded, their invocations will be checked according to the rulesfor the intrinsic functions; otherwise they will be checked as normal(user-written) external functions. The non-standard warningsare controlled by the -f77=intrinsic and -f77=intrinsic options. The default value of this setting is equivalent to-intrinsic=all followed by -intrinsic=no-vms for theUnix version, -intrinsic=no-unix for the VMS version,and -intrinsic=no-unix,no-vms for other versions. Note: In versions of ftnchek prior to 2.10, the-intrinsic flag took a numeric argument instead of a list ofoptions.For the sake of users who may have written scripts invokingftnchek in this way, the numeric form is stillaccepted. The numeric form of the setting consists of three digits.Theones digit selects the set of intrinsic functions to be supported.The digit 0 selects only Fortran 77 standard intrinsics plus those needed tosupport the nonstandard extended precision data types. The digit 1 isequivalent to extra, 2 isequivalent to extra,unix, and 3 is equivalent toextra,vms.The tens digit of this setting controls the syntax of the RANDintrinsic function, and the hundredsdigit controls the syntax of the IARGC function.For these digits,specify 0 to require invocation with no argument,1 to require one argument, and 2 to allow either form. See also: -f77.
- -library
- This switch is used when a number of subprograms arecontained in a file, but not all of them are used by the application.Normally, ftnchek warns you if any subprograms are defined butnever used. This switch will suppress these warnings. Default = no.
This switch also controls which subprogram calls and COMMONblock declarations are checked. If a fileis read with the -library flag in effect, the subprogram callsand COMMON declarations contained in a routine in that file willbe checked only if that routine is in the main program's call tree.On the other hand, if the -library switch isturned off, then ftnchek checks the calls of every routine byevery other routine, regardless of whether those routines could everactually be inv
|
|
|