On 06/01/2013 10:08 PM, Jens Bauer wrote:
> I would expect gcc to complain when it meets the second loop as well as the 
> third loop, but it didn't detect that there is something wrong with the 
> second loop.
> 
> ...Is this a bug ?

C allows you to index one element beyond the end of an array.  So, this

  uint8_t eightMembers[8];
  uint8_t *p = &eightMembers[8];

is legal, but

  uint8_t eightMembers[8];
  uint8_t *p = &eightMembers[9];

is not.

In both cases you cannot actually use the memory at *p.  I think gcc is
detecting the indexing but not the access.

Andrew.

Reply via email to