This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14470] New: x86 optimizer error (?)
- From: "lvoge at cs dot vu dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Mar 2004 22:13:16 -0000
- Subject: [Bug c/14470] New: x86 optimizer error (?)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
excuse me if this is stupidity on my part or me not understanding C properly, but:
int main() {
int t[123] = { 1024 }, d;
d = 0;
d = t[d]++;
printf("%d\n", d);
return 0;
}
dumps core when compiled with -O2 on intel. the trouble is that the fifth line
gets compiled as if it says d = t[d]; t[d]++;, it re-uses the register to index
the increment that just got the result of the dereference.
compiles and runs correctly with any optimization with the Intel compiler v7.0.
gcc without optimization runs correctly on intel. gcc on sparc64 and ppc with
any optimization also runs correctly.
--
Summary: x86 optimizer error (?)
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lvoge at cs dot vu dot nl
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: GNU C version 3.3.3 (Debian) (i486-linux)
GCC host triplet: GNU C version 3.3.3 (Debian) (i486-linux)
GCC target triplet: GNU C version 3.3.3 (Debian) (i486-linux)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14470