VMS Help
CC, Messages, BADBOUNDCHK

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

 Message        <Context> pointer arithmetic was performed more than
                once in computing an array element.  The bounds
                checking code output by the compiler will only verify
                the "<expr>" expression.

 Description    When an array is accessed using pointer arithmetic
                and run-time array bounds checking is enabled, the
                Compaq C compiler is only able to output the checking
                code for the first pointer arithmetic operation
                performed on the array.  This can result in an
                incorrect check if the resulting pointer value is
                again operated on by pointer arithmetic.  Consider
                the expression a = b + c - d; where a is a pointer, b
                an array, and c and d integers.  When bounds checking
                is enabled the compiler will output a check to verify
                that c within the bounds of the array.  This will
                lead to an incorrect runtime trap in cases where c is
                outside the bounds of the array and c - d is not.

 User Action    Recode the pointer expression so that the integer
                part is in parenthesis.  This way the expression will
                contain only one pointer arithmetic operation.  In
                the earlier example the expression would be changed
                to a = b + (c - d);
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.