[comp.lang.fortran] FORTRAN standards checker

karenk@pvi.UUCP (Karen Kruse) (06/07/89)

Does anyone know of a program that does FORTRAN standards checking and
runs on VAX/VMS, or Sun, or HP-9000? Ideally, it would:

1. flag all non-standard constructs (e.g. mixed character and non-character
   in a common block, non-standard characters like '!').

2. check for agreement between called and calling subroutines in number and
   type of parameters.

It would also be nice if it could check for unused variables, variables set but
never used, and variables used but never set.
  
Thanks in advance for any information!

Karen Kruse
Precision Visuals, Inc.
boulder!pvi!karenk

seibel@cgl.ucsf.edu (George Seibel) (06/07/89)

In article <248@pvi.UUCP> karenk@.com() writes:
>Does anyone know of a program that does FORTRAN standards checking and
>runs on VAX/VMS, or Sun, or HP-9000? Ideally, it would:
>
>1. flag all non-standard constructs (e.g. mixed character and non-character
>   in a common block, non-standard characters like '!').
>
>2. check for agreement between called and calling subroutines in number and
>   type of parameters.
>
>It would also be nice if it could check for unused variables, variables set but
>never used, and variables used but never set.

  You might try Flint, a "FORTRAN 77 reliability, complexity, portability
and 8X compatibility checking tool"  (their description) from:
   Programming Research Ltd.,
   King's Avenue House, King's Avenue,
   New Malden, Surrey, KT3 4BY, UK

Flint will do all this stuff.   You might also want ot look at TOOLPAK.
it's public domain, available for free via anon. ftp from somewhere...
I'm pretty sure it does at least some of these things, I know that it
does a lot of other nice stuff.   I have never seen a tool like what
you are asking for that was as easy to use as I think it ought to be.

On VAX/VMS, use FORTRAN/STANDARD.  It's pretty good at catching non-ANSI
constructs.   The Convex compilers from 4.0 on will catch accesses of
uninitialized variables.  I can't tell you how useful this is.  Sun and
SGI compilers will flag mismatched common block lengths, but not uninitialized
variables.   BSD f77 will find variables declared but unused (if explicitly
typed).   A lot of compilers catch statement labels that are defined but
unreferenced.   I would certainly like it if I could get all of the above
plus argument checking built in to one compiler;  I realize the difficulty
that independantly compiled modules present, but when all the modules are
there, why not do a cursory argument check?   Any vendors listening out there?

George Seibel, UCSF

garrett@oscar.ccm.udel.edu (06/08/89)

In article <11636@cgl.ucsf.EDU>, seibel@cgl.ucsf.edu (George Seibel) writes...

>In article <248@pvi.UUCP> karenk@.com() writes:
>>Does anyone know of a program that does FORTRAN standards checking and
>>runs on VAX/VMS, or Sun, or HP-9000? Ideally, it would:
>>
>>1. flag all non-standard constructs (e.g. mixed character and non-character
>>   in a common block, non-standard characters like '!').
>>
>>2. check for agreement between called and calling subroutines in number and
>>   type of parameters.
>>
>>It would also be nice if it could check for unused variables, variables set but
>>never used, and variables used but never set.
> 
The IBM VS FORTRAN compiler does a pretty good job of flagging some of these
things.  The ICA (Inter-Compilation Analysis) tool will catch inconsitent
usage across program units for arguments to subroutines.  The FIPS option will
flag all non ANSI fortran coding, etc.  You can see what routines, labels, etc
aren't in use by using the XREF stuff.  Now if only they could do something
about the operating systems you have to use to run this very nice compiler
(VM/MVS/etc...) (Guess this wasn't much help, you wanted VAX solutions, etc.
doesn't DEC sell a layered software product that will do most of this stuff?)

+-------------------------------------+--------------------------------------+
| Joel J. Garrett, Research Associate |         Phone: (302)-451-2332        |
|   Center for Composite Materials    |   inet:  garrett@oscar.ccm.udel.edu  |
|       University of Delaware        |                - or -                |
|       Newark, Delaware 19716        |          garrett@udel.edu            |
+-------------------------------------+--------------------------------------+

cunniff@hpfcdc.HP.COM (Ross Cunniff) (06/08/89)

> Does anyone know of a program that does FORTRAN standards checking and
> runs on VAX/VMS, or Sun, or HP-9000? Ideally, it would:
>
> 1. flag all non-standard constructs (e.g. mixed character and non-character
>    in a common block, non-standard characters like '!').
>
On the HP9000, the -a option to f77(1) does this.

> 2. check for agreement between called and calling subroutines in number and
>    type of parameters.
>
> It would also be nice if it could check for unused variables,variables set but
> never used, and variables used but never set.

On the HP9000 (series 300/HP-UX 6.2 or greater only) the flint tool can do
both of these.  HP flint bears no relation to the commercial product of the
same name that is distrubuted by another company (whose name I cannot
remember right at this moment...).  Note that flint also accepts the -a
flag.

> Karen Kruse
> Precision Visuals, Inc.
> boulder!pvi!karenk

				Ross Cunniff
				Hewlett-Packard Colorado Languages Lab
				...{ucbvax,hplabs}!hpfcla!cunniff
				cunniff%hpfcrt@hplabs.HP.COM

jbc@hpcllmv.HP.COM (Jeff Caldwell) (06/08/89)

>Does anyone know of a program that does FORTRAN standards checking and
>runs on VAX/VMS, or Sun, or HP-9000? Ideally, it would:

On the HP-9000 series machines (and 3000 series) the compiler has a 
$ANSI directive that will include warning messages for non ANSI 77 standard
features used.  The $RANGE directive will also do quite a bit of checking
for for things such as assinged GOTO's, subscripts, bit-manipulation
intrinsic functions, etc.

			-Jeff Caldwell
*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*
* Disclaimer: Opinions expressed herein are my own and do not necessarily *
*             reflect those of my employer.                               *
*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*

morice@prlhp1.prl.philips.co.uk (morice) (06/27/89)

The TOOLPACK suite of sofware tools contains, among other goodies a Fortran
standard and portability checker.   Contact Nag Ltd, Wilkinson House, Jordan
Hill Road, Oxford, England.  For more information.

We use it, we like it!  Its also public domain and the only charges are for
distribution.

charles@yc.estec.nl (Charles Stroom) (06/30/89)

We use Forcheck from Leiden University (NL) and are very much
satisfied.  It checks the syntax of separate program units, but
also of the program as a whole, including parameter verification
(number of arguments, type declaration, etc.)
There is also an option to check the syntax against a number of
machine-specific fortran compilers (Vax, IBM, etc).

It's available from Leiden University, Physiology Department, 
P.O. Box 9604, 2300 RC Leiden, Netherlands, (mr Kruyt,
EARN/BITNET: KRUYT@HLERUL53).


Charles Stroom

charles@yc.estec.nl  or	CSTROOM@ESTEC.BITNET
European Space Technology Centre, Noordwijk, the Netherlands