Static verification is an additional diagnostic capability to help you debug your programs. You can use the static verification options to detect potential errors in your compiled code including:
Static verification options can be used to analyze and find issues with source files; these source files need not form a whole program. (For instance, you can pass sources for libraries on the static verification command line.) In such cases, because only partial information is available about usage and modification of global objects, calls to routines, and so forth, analysis will be less exact.
Your code must successfully compile, with no errors, for static verification options to take effect.
The current usage model is that static verification is added as an alternate build option to produce a diagnostic report. When you enable static verification, the compiler will not create an executable file. Object files that are produced when using static verification are not valid and should not be used for generating real executable or static/dynamic link libraries.
Static verification cannot be used in conjunction with cross-file interprocedural optimization (/Qipo or -ipo).
Due to generalization of input data (static verification is performed for all possible input data), static verification cannot detect all possible errors that may appear during program execution.
Static verification uses a set of heuristics associated with the modification and usage of program objects. For example, when an undefined element of an array is set to some value, it is assumed that any arbitrary element of the array has been set to the same value. Similarly, after an undefined procedure call, it is assumed that all arguments substituted by reference are used and possibly modified.
Run-time checking executes a program with a fixed set of values for its input variables so it is difficult to check all edge effects. However, static verification performs a general overview check of a program for all possible values simultaneously.
Use the -diag-enable sv{[1|2|3]} (Linux* and Mac OS* X) or /Qdiag-enable:sv{[1|2|3]} (Windows*) compiler option to enable static verification. The number specifies the severity level of the diagnostics (1=all critical errors, 2=all errors, and 3=all errors and warnings).
The command line can contain multiple source files; object files are created for each source file. All object files are processed simultaneously.
Other related options include the following:
-diag-disable sv |
Disables static verification |
-diag-disable warn |
Suppresses all warnings, cautions and comments (issues errors only), including those specific to static verification |
-diag-disable num-list |
Suppresses messages by number list, where num-list is either a single message or a list of message numbers separated by commas and enclosed in parentheses. |
-diag-file [file] |
Directs diagnostic results to file with .diag as the default extension. You need to enable static verification diagnostics before you can send them to a file. If a file name is not specified, the diagnostics are sent to name-of-the-first-source-file.diag. |
-diag-file-append[=file] |
Appends diagnostic results to file with .diag as the default extension. You need to enable static verification diagnostics before you can send the results to a file. If you do not specify a path, the current working directory will be searched. If the named file is not found, a new file with that name will be created. If a file name is not specified, the diagnostics are sent to name-of-the-first-source-file.diag. |
-diag-enable sv-include |
Diagnoses include files as well as source(s) |
If the -c (Linux OS and Mac OS X) or /c (Windows OS) compiler option is used on the command line along with a command line option to enable static verification, an object file is created; static verification diagnostics are not produced. This object file may be used in a further invocation of static verification. This feature is useful when a program consists of files written in different languages (C/C++ and Fortran).
To analyze OpenMP directives, add the -openmp (Linux OS and Mac OS X) or /Qopenmp (Windows OS) option to the command line.
When static verification support is enabled within the IDE, the customary final build target (e.g. an executable image) is not created. Therefore, create a separate "Static Verification" configuration.
In the Microsoft Visual Studio Environment, modify the existing Debug (development) configuration, as follows:
With the new configuration active, navigate to the Intel(R) Fortran > Diagnostics property page. Use the Level of Static Analysis and Analyze Include Files properties to control static verification.
In the Xcode* IDE, modify the existing debug (development) configuration, as follows:
With the Configuration set to the new configuration, navigate to the Intel compiler's DIAGNOSTIC collection of properties. Use the Level of Static Analysis and Analyze Include Files properties to control static verification.
Set the Active Target and Active Build Configuration appropriately to BUILD the static verification enabled configuration.
Static verification capabilities include the following: