This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33572] New: wrong code with -O
- From: "wouter dot vermaelen at scarlet dot be" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Sep 2007 16:03:04 -0000
- Subject: [Bug c++/33572] New: wrong code with -O
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
> cat bug.cc
#include <vector>
#include <memory>
struct Foo { virtual void f() {} };
int main(int argc, char**)
{
std::auto_ptr<Foo> foo;
if (argc) {
foo.reset(new Foo());
} else {
std::vector<int> v;
}
Foo* p = foo.release();
p->f();
}
> g++ -O bug.cc
> a.out
Segmentation fault (core dumped)
I'm using SVN revision 128838 on linux-x86_64.
Without -O or with g++ version 4.2.1 this program works correctly.
--
Summary: wrong code with -O
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wouter dot vermaelen at scarlet dot be
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33572