------- Comment #2 from pinskia at gcc dot gnu dot org  2008-10-29 01:34 -------
    counter += inc(&counter);

That is undefined code as you access counter without a sequence point where you
assign it.
So it is valid for GCC to change the above to:
int tmp = counter;
tmp += inc(&counter);
counter = tmp;

Or
int tmp = inc(&counter);
counter += tmp;

The same thing happens with     p->counter += inc(p);
 except instead s/counter/p->counter/ and s/&counter/p/.

Thanks,
Andrew Pinski


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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

Reply via email to