public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wouter dot vermaelen at scarlet dot be" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/33572]  New: wrong code with -O
Date: Thu, 27 Sep 2007 16:03:00 -0000	[thread overview]
Message-ID: <bug-33572-8535@http.gcc.gnu.org/bugzilla/> (raw)

> 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


             reply	other threads:[~2007-09-27 16:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-27 16:03 wouter dot vermaelen at scarlet dot be [this message]
2007-09-27 16:37 ` [Bug c++/33572] " pcarlini at suse dot de
2007-09-27 20:21 ` belyshev at depni dot sinp dot msu dot ru
2007-09-27 20:31 ` wouter dot vermaelen at scarlet dot be
2007-09-27 20:31 ` wouter dot vermaelen at scarlet dot be
2007-09-27 21:03 ` [Bug tree-optimization/33572] [4.3 Regression] " rguenth at gcc dot gnu dot org
2007-09-27 21:19 ` pcarlini at suse dot de
2007-09-28 12:28 ` rguenth at gcc dot gnu dot org
2007-09-28 12:59 ` rguenth at gcc dot gnu dot org
2007-09-30 12:41 ` rguenth at gcc dot gnu dot org
2007-09-30 12:51 ` rguenth at gcc dot gnu dot org
2007-09-30 13:41 ` dnovillo at google dot com
2007-09-30 14:01 ` rguenther at suse dot de
2007-10-01 19:55 ` aoliva at gcc dot gnu dot org
2007-10-02  1:38 ` aoliva at gcc dot gnu dot org
2007-10-03  1:05 ` aoliva at gcc dot gnu dot org
2007-10-06 11:45 ` aoliva at gcc dot gnu dot org
2007-10-07 14:40 ` hjl at lucon dot org
2007-10-08 16:42 ` danglin at gcc dot gnu dot org
2007-10-08 23:57 ` aoliva at gcc dot gnu dot org
2007-10-09  4:47 ` aoliva at gcc dot gnu dot org
2007-10-09  4:48 ` aoliva at gcc dot gnu dot org
2007-10-15 17:08 ` aoliva at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-33572-8535@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).