When the following program is compiled with gcc the output of the array-value is 1 2 3 4 5 6. Icc and cl produce the output 1 2 3 4 1 2. If the arrray is susbtituted by a simple scalar, the gcc output is 1 2 3 4 1 2, too.
I don't know if the statement if even valid and behavior-defined C code. If it's not, then gcc maybe should warn somehow. Thanks, Gregor PS: This hapens with gcc-snapshot 20070720-1, too. -- Summary: Miscompiled statement a[i] = (a[i]++) % x; Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gjasny at web dot de GCC build triplet: i486-pc-linux-gnu GCC host triplet: i486-pc-linux-gnu GCC target triplet: i486-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33043