This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16590] [3.4 regression] Incorrect execution when compiling with -O2
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jul 2004 15:39:47 -0000
- Subject: [Bug c++/16590] [3.4 regression] Incorrect execution when compiling with -O2
- References: <20040716145633.16590.m.galante@centrosistemi.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-07-16 15:39 -------
Confirmed. Here's a very fragile testcase (if you change a bit, the
bug goes away):
------------------------
extern "C" void abort();
struct iterator {
char * p;
int *dummy;
};
static iterator pend(char * start) {
iterator p = {start, 0};
if (p.p == start) p.p = start+5;
--p.p;
return p;
}
int main() {
char mem[4+1];
if(pend(mem).p != mem+4)
abort ();
}
------------------------
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc ; ./a.out
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -O2 x.cc ; ./a.out
Aborted
The bug doesn't happen with 3.3.4 and mainline, but who knows whether this
is due to a fix or just by chance. It's a regression in any case, so
should be investigated, then we can see whether the same fix is
necessary on other branches than 3.4.x as well.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |wrong-code
Known to fail| |3.4.0
Known to work| |3.3.4 3.5.0
Last reconfirmed|0000-00-00 00:00:00 |2004-07-16 15:39:46
date| |
Summary|Incorrect execution when |[3.4 regression] Incorrect
|compiling with -O2 |execution when compiling
| |with -O2
Target Milestone|--- |3.4.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16590