Intel® C++ Compiler XE 13.1 User and Reference Guides

Pointer Checker Feature Summary

The pointer checker provides a number of related elements, summarized in the following table.

Element Description
Compiler Options:

/Qcheck-pointers:[none | write | rw] (Windows* OS)

-check-pointers=[none | write | rw] (Linux* OS)

Enables the pointer checker and adds the associated libraries.

This compiler option enables checking of all indirect accesses through pointers and accesses to arrays.

The pointer checker is off by default.

Specify none to disable the pointer checker.

Specify write to check bounds for writes through pointers only.

Specify rw to check bounds for both reads and writes through pointers.

If the compiler determines that an access is safe during optimization, then the compiler removes the pointer checking code.

See Checking Bounds.

/Qcheck-pointers-dangling:[none | heap | stack | all] (Windows* OS)

-check-pointers-dangling=[none | heap | stack | all] (Linux* OS)

Enables checking for dangling pointer references.

Note

To use this option, you must also use the /Qcheck-pointers or -check-pointers option.

The default is no checking for dangling pointer references.

Specify none to disable checking for dangling pointer references.

Specify heap to check for dangling pointer references on the heap.

Specify stack to check for dangling pointer references on the stack.

Specify all to check for dangling pointer references on both the heap and the stack.

See Checking for Dangling Pointers.

/Qcheck-pointers-undimensioned[-] (Windows* OS)

-[no-]check-pointers-undimensioned (Linux* OS)

Enables the checking of bounds for arrays without dimensions.

Note

To use this option, you must also use the /Qcheck- pointers or -check-pointers option.

See Checking Arrays.

Intrinsics:
void * __chkp_lower_bound(void **)

Returns the lower bound associated with the pointer.

See Writing a Wrapper.

void * __chkp_upper_bound(void **)

Returns the upper bound associated with the pointer.

See Writing a Wrapper.

void * __chkp_kill_bounds(void *p)

Removes the bounds information to allow the pointer specified in the argument to access all memory. Use this function for a pointer from a non-enabled module that will be used in an enabled module where you cannot determine the bounds of the pointer.

The function ensures that the pointer created from a non-enabled module does not inherit the bounds from another pointer that was in the same memory address.

The return value is a pointer without bounds information.

See Working with Enabled and Non-Enabled Modules.

void * __chkp_make_bounds(void *p, size_t size)

Creates new bounds information within the allocated memory address for the pointer in the argument, replacing any previously associated bounds information.

The new bounds are:

p = __chkp_make_bounds(q, size)

// lower_bound(p) = (char *)q
// upper_bound(p) = lower_bound(p) + size

See Checking Custom Memory Allocators.

Reporting Function:
void __chkp_report_control(__chkp_report_option_t option, __chkp_callback_t callback)

Determines how errors are reported.

See Finding and Reporting Out-of-Bounds Errors.

Enumeration:

__chkp_report_option_t

Controls how out-of-bounds error are reported. This enumeration is declared in the header file chkp.h.

See Finding and Reporting Out-of-Bounds Errors.

Environment Variable:

INTEL_CHKP_REPORT_MODE

Changes the pointer checker reporting mode at runtime.

See Finding and Reporting Out-of-Bounds Errors.

Header file:

chkp.h

Defines intrinsic and reporting functions. The header file is located n the <install-dir>\include directory.

See Also


Submit feedback on this help topic