Intel® Fortran Compiler 17.0 Developer Guide and Reference
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 #error number: message
Diagnostic |
Meaning |
---|---|
filename |
Indicates the name of the source file currently being processed. |
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. |
Error Message Example |
---|
echar.for(7): error #6321: An unterminated block exits. DO I=1,5 -------^ |
The pointer (---^) indicates the 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 the watch option.
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 option and check implicit interfaces using the warn[:]interfaces option.
You can use a number of compiler options to control the diagnostic messages issued by the compiler. For example, compiler option WB turns compile time bounds errors into warnings. To control compiler diagnostic messages (such as warning messages), use the warn option. This option controls warnings issued by the compiler and supports a wide range of keywords. 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 variations of the [Q]diag compiler option. This compiler option accepts numerous arguments and values, allowing you wide control over displayed diagnostic messages and reports.
Some of the most common variations include the following:
Linux* and OS X* |
Windows* |
Description |
---|---|---|
-diag-enable =list |
/Qdiag-enable:list |
Enables a diagnostic message or a group of messages |
-diag-disable =list |
/Qdiag-disable:list |
Disables a diagnostic message or a group of messages |
-diag-warning =list |
/Qdiag-warning:list |
Tells the compiler to change diagnostics to warnings |
-diag-error =list |
/Qdiag-error:list |
Tells the compiler to change diagnostics to errors |
-diag-remark =list |
/Qdiag-remark:list |
Tells the compiler to change diagnostics to remarks (comments) |
The list items can be specific diagnostic IDs, one of the keywords warn, remark, or error, or a keyword specifying a certain group (par, vec, driver, cpu-dispatch). For more information, see [Q]diag.
Additionally, you can use the following related options:
Linux* and OS X* |
Windows* |
Description |
---|---|---|
-diag-dump |
/Qdiag-dump |
Tells the compiler to print all enabled diagnostic messages and stop compilation. |
-diag-file[=file] |
/Qdiag-file[:file] |
Causes the results of diagnostic analysis to be output to a file. |
-diag-file-append[=file] |
/Qdiag-file-append[:file] |
Causes the results of diagnostic analysis to be appended to a file. |
-diag-error-limit=n |
/Qdiag-error-limit:n |
Specifies the maximum number of errors allowed before compilation stops. |
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 the watch option.
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 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 nowarn 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 file containing the error and prevent linking, but they do not stop the compiler from scanning 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 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 compilervars.sh (Linux* and OS X*) or compilervars.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. For a list of environment variables used by the ifort command during compilation, see Supported 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:
Double-click the error message text in the Build pane of the Output window.
- or -
Press F8. The editor window appears with a marker in the left margin that identifies the line causing the error. You can continue to press F8 to scroll through additional errors.
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.