http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53073



--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-31 
09:28:28 UTC ---

FYI, regarding validity in C89, the wording there is similar to C99.

ISO C89, 6.3.1.2 says that d[++k] is equivalent to:

  (*((d)+(++k)))

and ++k in the last iteration is 16, so it is

  (*(d+16))

and then 6.3.6 part applies:

"Unless both the pointer operand and the result point to elements of the

same array object, or the pointer operand points one past the last element  

of an array object and the result points to an element of the same array

object, the behavior is undefined if the result is used as an operand of the 

unary * operator."

Here the pointer operand points to the first element of array (&d[0]) and

the result points one past the last element of the array object, so again, the

behavior is undefined.

Reply via email to