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



Jakub Jelinek <jakub at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |jakub at gcc dot gnu.org



--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-15 
17:56:05 UTC ---

You're wrong, the code in #c2 is not valid C.

ISO C99 6.5.2.1 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.5.6/8 (last sentence) applies:

"If the result points one past the last element of the array object, it

shall not be used as the operand of a unary * operator that is evaluated."

So, if you ever enter this loop, you'll invoke undefined behavior and anything

can happen.

Reply via email to