This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: BPs & cleanups for ARRAY_SIZE
- To: Greg McGary <greg at mcgary dot org>
- Subject: Re: PATCH: BPs & cleanups for ARRAY_SIZE
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 23 Aug 2000 14:12:42 -0600
- cc: Raja R Harinath <harinath at cs dot umn dot edu>, gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <msitsr22h4.fsf@mcgary.org>you write:
> > Then, there's no violation of bounds if 'p' is stepped 27 times,
> > instead of nested loops.
>
> ISO/IEC 9899/1999 (E)
>
> Programming languages -- C
>
> Annex J (informative)
> Portability Issues
> ...
> J.2 Undefined behavior
>
> The behavior is undefined in the following circumstances:
> ...
> -- An array subscript is out of range, even if an object
> is apparently accessible with the given subscript (as
> in the lvalue expression a[1][7] given the declaration
> int a[4][5]) (6.5.6).
Wow. I never knew that. Thanks for the info. Consider your full patch
approved.
jeff