The Intel® Fortran Compiler identifies syntax errors and violations of language rules in the source program.
These messages describe diagnostics that are reported during the processing of the source file. Compiler diagnostic messages usually provide enough information for you to determine the cause of an error and correct it. These messages generally have the following format:
filename(linenum:) severity: message
filename |
Indicates the name of the source file currently being processed. An extension to the filename indicates the type of the source file, as follows: .f, .f90, .for indicate a Fortran file. |
linenum |
Indicates the source line where the compiler detects the condition. |
severity |
Indicates the severity of the diagnostic message: Warning, Error, or Fatal error. |
message |
Describes the problem. |
The following is an example of an error message showing the format and message text:
echar.for(7): Severe: Unclosed DO loop or IF block
DO I=1,5
--------^
The pointer (---^) indicates the exact place on the source program line where the error was found, in this case where an END DO statement was omitted.
To view the passes as they execute on the command line, specify -watch (Linux) or /watch (Windows).
You can use a number of compiler options to control the diagnostic messages issued by the compiler. For example, the -WB (Linux* and Mac OS*) or /WB (Windows*) compiler option turns compile time bounds errors into warnings. To control compiler diagnostic messages (such as warning messages), use -warn (Linux and Mac OS*) or /warn (Windows*). The -warn [keyword] (Linux and Mac OS) or /warn:keyword (Windows) option controls warnings issued by the compiler and supports a wide range of values. Some of these are as follows:
[no]alignments -- Determines whether warnings occur for data that is not naturally aligned.
[no]declarations -- Determines whether warnings occur for any undeclared symbols.
[no]errors -- Determines whether warnings are changed to errors.
[no]general -- Determines whether warning messages and informational messages are issued by the compiler.
[no]interfaces -- Determines whether warnings about the interfaces for all called SUBROUTINEs and invoked FUNCTIONs are issued by the compiler.
[no]stderrors -- Determines whether warnings about Fortran standard violations are changed to errors.
[no]truncated_source -- Determines whether warnings occur when source exceeds the maximum column width in fixed-format files.
For more information, see the -warn compiler option.
You can also control the display of diagnostic information with -diag (Linux and Mac OS) or /Qdiag (Windows). This compiler option accepts numerous arguments and values, allowing you wide control over displayed diagnostic messages and reports.
You can perform compile-time procedure interface checking between routines with no explicit interfaces present. To do this, generate a module containing the interface for each compiled routine using the -gen-interfaces (Linux and Mac OS) or /gen-interfaces (Windows) option and check implicit interfaces using the -warn interfaces (Linux and Mac OS) or /warn:interfaces (Windows) option.
If the linker detects any errors while linking object modules, it displays messages about their cause and severity. If any errors occur, the linker does not produce an executable file. Linker messages are descriptive, and you do not normally need additional information to determine the specific error.
To view the libraries being passed to the linker on the command line, specify -watch or /watch.
These messages indicate valid but inadvisable use of the language being compiled. The compiler displays comments by default. You can suppress comment messages with the -warn nousage (Linux and Mac OS) or /warn:nousage (Windows) option.
Comment messages do not terminate translation or linking, they do not interfere with any output files either. Some examples of the comment messages are:
Null CASE construct
The use of a non-integer DO loop variable or expression
Terminating a DO loop with a statement other than CONTINUE or ENDDO
These messages report valid but questionable use of the language being compiled. The compiler displays warnings by default. You can suppress warning messages by using the -warn or /warn option. Warnings do not stop translation or linking. Warnings do not interfere with any output files. Some representative warning messages are:
constant truncated - precision too great
non-blank characters beyond column 72 ignored
Hollerith size exceeds that required by the context
These messages report syntactic or semantic misuse of Fortran.
Errors suppress object code for the error containing the error and prevent linking, but they do not stop from parsing to continue to scan for any other errors. Some typical examples of error messages are:
line exceeds 132 characters
unbalanced parenthesis
incomplete string
Fatal messages indicate environmental problems. Fatal error conditions stop translation, assembly, and linking. If a fatal error ends compilation, the compiler displays a termination message on standard error output. Some representative fatal error messages are:
Disk is full, no space to write object file
Incorrect number of intrinsic arguments
Too many segments, object format cannot support this many segments
If you are using the command line, messages are written to the standard error output file.
When using the command line:
Make sure that the appropriate environment variables
have been set by executing the ifortvars.sh (Linux
and Mac OS) or IFORTVARS.BAT
(Windows) file. For example, this BAT file sets the environment variables
for the include and library directory paths. For Windows*, these environment
variables are preset if you use the Fortran Command Prompt window in the
Intel Visual Fortran program folder
(see Using the Command Line for
more information on the command prompt window). For
a list of environment variables used by the ifort command during compilation,
see Setting Compile-Time Environment Variables.
Specify the libraries to be linked against using compiler options.
You can specify libraries (include the path, if needed) as file names on the command line.
If you are using the Microsoft Visual Studio* integrated development environment (IDE), compiler and linker errors are displayed in the Build pane of the Output window. To display the Output window, choose View>Other Windows>Output. You can also use the Task List window (View>Other Windows>Task List) to view display links to problems encountered during the build process. Click these tasks to jump to code that caused build problems. You can also check the Build log for more information.
To quickly locate the source line causing the error, follow these steps:
- or -
After you have corrected any compiler errors reported during the previous build, choose Build project name from the Build menu. The build engine recompiles only those files that have changed, or which refer to changed include or module files. If all files in your project compile without errors, the build engine links the object files and libraries to create your program or library.
You can force the build engine to recompile all source files in the project by selecting Rebuild project name from the Build menu. This is useful to verify that all of your source code is clean, especially if you are using a makefile, or if you use a new set of compiler options for all of the files in your project.
When using the IDE:
Make sure that you have specified the correct path, library, and include directories. For more information, see Specifying Path, Library and Include Directories.
If a compiler option is not available through Project>Properties in the Intel Fortran Property pages, you can type the option in the Command Line category. Use the lower part of the window under Additional Options: just as you would using the command line. For example, you can enter the linker option /link /DEFAULTLIB to specify an additional library.