Compilation diagnostics

During compilation, three types of messages can be output:

  1. ERROR MESSAGES which indicate that the rules Fortran 95 have not been obeyed, for example, that a label has been referenced but not defined. When FTN95 is invoked from a command line, error messages are preceded by *** (three asterisks).

It is possible (but not recommended) to load and execute a program that contains compilation errors (if the /PERSIST option was used) but unpredictable results will occur if the parts that are executed contain compilation errors. If /PERSIST is not used, the compiler will cease code generation once an error has been reported and the relocatable binary file will be marked to make it unloadable.

Note that certain error conditions become fatal when the /ISO option is used otherwise they are classed as warnings.

  1. WARNINGS are output for one of two reasons:

  • If the program is correct Fortran but probably contains a logic error. For example, the following statement is legal but will cause an infinite loop:

10 GOTO 10

In the following example, the compiler will warn that the second statement will never be executed.

A = B
C = D
. . .

  • Each time the program uses those ex tensions to Fortran 95 which have been included in order to allow compatibility with Fortran 66.

For example, users converting programs containing Hollerith data will find their listings annotated with the message:

Warning: The use of Hollerith data is an extension to Fortran 95.

It is always possible to load and execute a program whose compilation produces only warnings.

  1. COMMENTS are informative messages. They serve to remind the programmer that there might be a better way of writing a particular statement. As an example, the statement


would cause the compiler to output the message:

COMMENT: FLOAT could be replaced by its generic equivalent (REAL) throughout this program unit

When FTN95 is used from a command line, most messages are output immediately after the statement to which they refer.

If it is necessary to delay the output of a message or the source listing option has not been chosen, the message is followed by a line number which refers to the source file. Certain error messages referring to EQUIVALENCE statements are always output (with a line number reference) immediately after the first executable statement in a program unit has been listed.

Some messages, notably those referring to undefined or unused labels, are not output until the END statement of a program unit has been processed.

Each diagnostic message has an associated error number. It is possible to instruct the compiler to ignore every occurrence of the error associated with a particular error number by using the /IGNORE compiler option as follows:

FTN95 MYFILE /IGNORE <error number>

where <error number> is the number of the error that is to be ignored. This number can be obtained by using the /ERROR_NUMBERS compiler option in an earlier compilation that exhibits the error. More than one /IGNORE option can be specified, if it is desired, in order to ignore several errors.


If messages other than warnings or comments are ignored, the compiler may generate incorrect code.



Copyright © 1999-2021 Silverfrost Limited