How the Compiler Defines Bounds Information for Pointers
The pointer checker is not supported on
The following defines how the compiler determines the bound information for pointers.
In each section,
lower_bound(refers to the lower bound associated with
upper_bound(refers to the upper bound associated with
Pointers created by the alloca() function
Pointers created by the calloc() function
Pointers created by the
Pointers created by casting
Casting a pointer does not affect the bounds of a pointer. If you cast a pointer to a new type that is larger than the bounds associated with the original pointer, you will get an out-of-bounds error when you try to access any member or element outside the original bounds. If you cast a pointer to a smaller type than the original pointer, you can still access the original data.
Pointers created for a variable length array in a structure
When you define an array as the last member of a structure, the upper bound is not narrowed and is allowed to access all of the array elements allocated by the
Pointers defined by the address (&) operator
The bounds information is narrowed to the size of the member when you point to a member of a structure, union, or class.
Pointers defined by the new operator
Pointers defined by the addresses in an array
When you take the address of an element of an array or the address of a single row of a multi-dimensioned array, the bounds are not narrowed to the size of the element. You can increment or decrement the pointer throughout the array.
Incrementing and Decrementing Pointers
When you take the address of a member of an element, the bounds are narrowed to the size of the member.
Pointers defined by pointer copies
The bounds are copied from
q. Offsetting the pointer on the right does not affect the bounds.
Pointers defined by incrementing or decrementing a pointer
The bounds do not change when you increment or decrement a pointer.