Defining Suppression Rules in the GUI

Prerequisite: Apply suppressions when you configure a project.

To create a suppression rule to help you focus during future analysis runs on only those issues that require your attention:

  1. Choose problems to suppress during future analysis runs.

  2. Identify the new rule by name and storage location.

  3. Widen the default rule reach to suppress the greatest number of relevant problems.

  4. Save the rule.

Tip

  • Although you are ultimately trying to suppress problems, the Intel Inspectorvehicle for defining a suppression rule is one or more code locations.

  • Narrow rules suppress a limited number of relevant problems; wider rules suppress a greater number of relevant problems.

  • Every rule applied during analysis adds processing time.

  • The goal: Suppress the greatest number of relevant problems with the fewest number of rules.

  • To review rules to be applied during analysis, check the Suppressions tab of the Project Properties dialog box.

  • To apply rules during analysis, select the Apply Suppressions radio button on the Target tab of the Project Properties dialog box.

  • A code location may be part of multiple problems; therefore, multiple rules may suppress the same code location, or a rule created to suppress one problem may partially impact another problem.

1. Choose Problems to Suppress During Future Analysis Runs

  1. In the Code Locations pane, right-click a code location for an occurrence of the problem you want to suppress during future analysis runs.

  2. In the context menu, choose Suppress....

Outcome: The Intel Inspector displays the Create Suppression dialog box. The Rule grid in the center of the dialog box shows the right-clicked code location and any related code locations in the specific occurrence of the problem.

2. Identify the new rule by name and storage location

  1. In the Name text box, type a short description to distinguish the new rule from other rules.

  2. If you want to store the new rule somewhere besides the default location, browse to and choose a filename and/or location.

Tip

Choose a non-default location only to make the rule easily accessible to others.

3. Widen the default rule reach to suppress the greatest number of relevant problems

By default, the Intel Inspector drafts a rule that suppresses problems based on:

  • A specific problem type

  • All the code locations in the problem occurrence

  • A specific module, function, source, and line in the last-called stack frame in each code location.

To widen the rule reach, try one or more of the following - do not suppress problems by:

  • A specific problem type - In the Problem type drop-down list, click the drop-down arrow and choose * (any).

  • A specific code location - In the Rule grid, deselect the code location checkbox.

  • A specific code location description - In the Code Location Description drop-down list, click the drop-down arrow and choose * (any).

    Note

    There are three Code Location Description possibilities: Allocation site, Deallocation site, and * (any). Memory error example: If you right-click a Mismatched allocation site code location for an occurrence of a Mismatched allocation/deallocation problem, the Intel Inspector displays one code location marked Allocation site and one code location marked * (any); you can click the drop-down arrow to change Allocation site to * (any). Threading error example: If you right-click a Read code location for an occurrence of a Read/Write Data race problem, the Intel Inspector displays two code locations marked * (any) and does not provide drop-down arrows.

  • A specific stack frame module, function, source, and line number -

    1. Click a code location Edit button to open the Select Stack Frame(s) dialog box.

    2. Notice you can select a different stack frame or multiple stack frames as the rule focus.
    3. In the Module, Function, Source, and/or Line drop-down list for each selected stack frame, click the drop-down arrow and choose * (any)

Tip

  • A single code location with all but one characteristic set to * (any) is ideal for widening a rule to suppress the greatest number of relevant problems.

  • Suppression rules are more robust if you specify a stack with multiple frames instead of frames with line numbers. (Because line numbers can be altered by code insertions or deletions, suppressions may be rendered ineffective by even minor code maintenance. Stack-based suppressions require larger code changes to invalidate them, such as changes to function call sequences.)

4. Save the Rule

Click the Create button.

Outcome

Outcome:

  • Intel Inspector saves the new suppression rule in a .sup file.

  • In the Code Locations and Problems panes, the Intel Inspector marks (strikes through) all result data potentially impacted by the rule. (It may take some time for all marks to appear.) The marks remain in the result even if you close and then reopen the result.

    Tip

    Review the marked data to assess the effectiveness and potential reach of the rule. If necessary, delete the rule and start over, or edit the suppression file in a text editor.

  • During the next analysis run, if Suppressions in the Target tab of the Project Properties dialog box is set to:

    • Apply suppressions - The Intel Inspector does not collect result data impacted by the suppression rules in files and directories specified in the Suppressions tab of the Project Properties dialog box.

    • Do not apply suppressions - The Intel Inspector ignores all suppression rules.

For more complete information about compiler optimizations, see our Optimization Notice.