ptr[i] = ptr[++i]; when ptr is a pointer and compiled with -O then it behaves differently. Release: gcc version 2.95.2 19991024 (release) Environment: Linux 2.2.19, Pentium II How-To-Repeat: compile with "gcc -O"
Fix: ptr[i] = ptr[i+1]; i++;
State-Changed-From-To: open->closed State-Changed-Why: Not a bug - you should read up on sequence points. Basically, multiple reads of a variable (i) modified between sequence points is undefined. Your code falls into this category. So, ptr[i] = ptr[++i]; is fundamentally always meaningless.
Reopening to ...
Mark as a dup of bug 11751. *** This bug has been marked as a duplicate of 11751 ***