Intel® Fortran Compiler XE 13.1 User and Reference Guides

Using Static Analysis

Using Static Analysis from the Microsoft Visual Studio* IDE

To build your application for Static Analysis in Microsoft Visual Studio, use the Build for Intel Static Analysis menu option. This creates a new build configuration for static analysis and sets the required properties in the Visual Studio IDE.

There are several forms of the Build for Intel Static Analysis menu option, including:

These forms appear in all menus that can build projects or solutions, including the Build menu and the popup menu that appears when you right click on selected project(s) or on the solution.

The first time you use this menu option, a dialog box appears to guide you through the setup process.

Using Static Analysis for an Intel® Visual Fortran Solution

To perform Static Analysis on Intel® Visual Fortran solutions and projects:

  1. Choose Build for Intel Static Analysis.
  2. In the Create configuration dialog box, choose the following:
    • Copy configuration settings from: Specify the configuration from which settings should be copied
    • Level of Static Analysis: Select the desired level of analysis
    • Additional Options: Select Analyze Include Files if you would like to analyze system include files
  3. Leave the Build for Static Analysis after creating configuration checkbox checked. A new configuration called Intel_SSA is created and the project(s) selected for building with static analysis are built. (If you uncheck this checkbox, you will set up for static analysis but not run it at this time).

Analysis results will open automatically in the Intel® Inspector XE user interface.

There are several Microsoft Visual Studio* IDE property pages related to static analysis. You can change the options for static analysis by modifying the properties for the Intel_SSA configuration. To do this, use the following property pages:

Using Static Analysis from the Command Line

If you are building from the command line, you need to create a new build configuration or target distinct from your existing build configuration or target. Once you do this, you can add the command line options to enable static analysis. You must supply the options that request static analysis on each compilation and link step. The following table summarizes the static analysis options.

Option (Windows* and Linux* OS syntax)

Result

/Qdiag-enable:sc{[1|2|3]}

-diag-enable sc{[1|2|3]}

Enables static analysis. The number specifies the severity level of diagnostics reported (1=only critical errors, 2=all errors and warnings, and 3=all diagnostics regardless of severity level).

/Qdiag-enable:sc-{full|concise|precise}

-diag-enable sc-{full|concise|precise}

Enables static analysis and determines the analysis mode.

/Qdiag-disable:sc

-diag-disable sc

Disables static analysis

/Qdiag-enable:sc-include

-diag-enable sc-include

Analyzes include files as well as source files. By default apparent errors in include files are not reported.

/Qdiag-enable:sc-single-file

-diag-enable sc-single-file

Processes each file individually, skipping the usual whole-program analysis. This reduces memory requirements and analysis time on large programs, but may detect fewer real errors.

/Qdiag-sc-dir:dir

-diag-sc-dir dir

Directs diagnostic results to the given directory. If this option is not specified, results are directed to the current working directory. Each run creates results in a new subdirectory whose name has the form "r@@@sc", where "@@@" is replaced the next available sequence number (001, 002, ...).

This option requires that you also specify the compiler option to enable static analysis.

/Qdiag-enable:sc-enums

-diag-enable sc-enums

Instructs static analysis to treat enumeration variables in C++ programs as known values equal to any one of the associated enumeration literals. By default, static analysis treats unknown enumeration variables as unknown integer values. Setting this option may find additional errors, but tends to create more false positives.

Note

Even if your project must build on the command line, it is still possible to integrate your project into Visual Studio. To do this, create a Visual Studio "makefile project," in which case, Visual Studio will build the project by invoking a command line of your choosing. If you plan to use a makefile project, you should add the /Qdiag-sc-dir:dir or -diag-sc-dir dir option on the link step to direct the output to the "My Inspector XE Results-<product name>" folder in the project root directory. This allows Intel® Inspector XE to find your results and display them in the Visual Studio Solution Explorer. If you do not want to use Visual Studio at all, you should use the stand-alone form of the Intel® Inspector XE GUI. If you do this, you can place your results wherever you like.

To enable OpenMP*, specify the /Qopenmp (Windows* OS) or -openmp (Linux* OS) option. You must do this if your program uses OpenMP.

Considerations When Using Static Analysis


Submit feedback on this help topic