This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/33043] New: Miscompiled statement a[i] = (a[i]++) % x;
- From: "gjasny at web dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Aug 2007 10:50:38 -0000
- Subject: [Bug c/33043] New: Miscompiled statement a[i] = (a[i]++) % x;
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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