[Fwd: Re: bounds checking a GCC program]

Perry Smith pedz@easesoftware.com
Wed Dec 6 17:17:00 GMT 2006


On Dec 6, 2006, at 11:05 AM, Stuart Cracraft wrote:

> The issue that I had to solve by arduously single-stepping
> through a complex program (took a week) turned out to
> be a pointer stepping outside of pre-determined places
> within a single-dimensional array; that is, the pointer
> stayed within the overall array but stepped outside of
> determined areas within the array and this resulted
> in the clobbering of areas elsewhere.
>
> Having bounds checking that tells me when it stepped
> out of the overall array would not have helped.
>
> What is needed is something that says has it stepped
> out of a pre-defined area within a single array.
>
> My application is written in C and maintains its own
> stack which is what was clobbered.

boost.org has a C++ implementation of a "subrange".  I've never used it
and do not know much about it.  But it sounds like (as in Pascal), you
want you array indexes to be a subrange that is checked.  I think the
boost library can help you there.

Perry Smith ( pedz@easesoftware.com )
Ease Software, Inc. ( http://www.easesoftware.com )

Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems




More information about the Gcc-help mailing list