Suppression Rule Examples in Text Format

Tip

  • Although you are ultimately trying to suppress problems, the vehicle 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.

Suppression Rule Example 1

Suppression rule Example1 suppresses any problem where the last-called frame in the stack is in the m.so module.

Suppression = {
    Name = "Example1";
    Stacks = {
        { 
            mod=m.so;
        }
    }
}

Suppression Rule Example 2

Suppression rule Example2 suppresses any Data race problem with one code location in the a.out module, update_x function and another code location in the a.out module, update_y function.

Suppression = {
    Name = "Example2";
    Type = { datarace }
    Stacks = {
        { 
            mod=a.out, func=update_x; 
        }
        { 
            mod=a.out, func=update_y; 
        }
    }
}

Suppression Rule Example 3

Suppression rule Example3 suppresses any Memory not deallocated problem where the last-called frame in the stack is an Allocation site code location in the my_alloc function from the alloc.c source file.

Suppression = {
    Name = "Example3";
    Type = { reachable_memory_leak }
    Stacks = {
        allocation = {
            func=my_alloc, src=alloc.c;
        }
    }
}

Suppression Rule Example 4

Suppression rule Example4 suppresses any Uninitialized memory access where the last-called frame in the stack is in the _itoa_word function and the stack path is main calling printf calling vfprintf calling _itoa_word.

Suppression = {
    Name = "Example4";
    Type = { uninitialized_memory_access }
    Stacks = {
        {
            func=_itoa_word;
            func=vfprintf;
            func=printf;
            func=main;
        }
    }
}

Suppression Rule Example 5

Suppression rule Example5 suppresses any Memory leak problem where the last-called frame in the stack is in the malloc function and the stack path is main calling ccc calling ddd calling malloc, possibly through a series of interim function calls.

Suppression = {
    Name = "Example5";
    Type = { unreachable_memory_leak }
    Stacks = {
        {
            func=malloc;
            ...;
            func=ddd;
            ...;
            func=ccc;
            ...;
            func=main;
        }
    }
}

Suppression Rule Example 6

Suppression rule Example6 suppresses any problem with an Allocation site code location in the my_alloc function from the alloc.c source file anywhere in the stack.

Suppression = {
    Name = "Example6";
    Stacks = {
        allocation = {
            ...;
            func=my_alloc, src=alloc.c;
        }
    }
}

See Also


Supplemental documentation specific to a particular Intel Studio may be available at <install-dir>/<studio>/documentation/.

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