[Bug c++/33572] New: wrong code with -O
wouter dot vermaelen at scarlet dot be
gcc-bugzilla@gcc.gnu.org
Thu Sep 27 16:03:00 GMT 2007
> 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
More information about the Gcc-bugs
mailing list