VMS Help  —  CC  Messages  BADBOUNDCHK
 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 HP
                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 Help