This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/15020] -mcpu=pentium4 generates wrong code
- From: "rridge at csclub dot uwaterloo dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Apr 2004 01:26:15 -0000
- Subject: [Bug target/15020] -mcpu=pentium4 generates wrong code
- References: <20040420090531.15020.stl@caltech.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rridge at csclub dot uwaterloo dot ca 2004-04-21 01:26 -------
The bug is caused by GCC moving instructions that writs to the stack
(part of the exception frame setup) to before the call that probes the stack.
The following test case demonstrates the problem with both on GCC 3.3.3 as
well as 3.5.0 (HEAD). Compile with "g++ -O2 -mcpu=pentium4" or
"g++ -O2 -mtune=pentium4" as appropriate for the release.
int
foo() {
throw 1;
}
int
main(int argc, char **) {
char buf[1 * 1024 * 1024];
int r = argc;
/* Clobber ESI, EDI, EBP so they get pushed on the stack
in the prologue */
asm("/* */" : "=D" (r) : "0" (r));
asm("/* */" : "=S" (r) : "0" (r));
asm("/* */" : "=b" (r) : "0" (r));
try {
foo();
} catch(...) {
r = 0;
}
return r;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15020