public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/33572] [4.3 Regression] wrong code with -O
Date: Thu, 27 Sep 2007 21:03:00 -0000	[thread overview]
Message-ID: <20070927210318.2721.qmail@sourceware.org> (raw)
In-Reply-To: <bug-33572-8535@http.gcc.gnu.org/bugzilla/>



------- Comment #5 from rguenth at gcc dot gnu dot org  2007-09-27 21:03 -------
Confirmed.  The reduced testcase gets optimized to

<bb 3>:
  D.2145 = operator new (8);

<bb 4>:
  ((struct Foo *) D.2145)->_vptr.Foo = &_ZTV3Foo[2];

<bb 5>:
  D.2147 ={v} 0B->_vptr.Foo;
  OBJ_TYPE_REF(*D.2147;0B->0) (0B);

where dereferencing NULL obviously is bogus.  After 038t.sdse2 everything
looks ok:

<bb 4>:
  D.2124_3 = (struct Foo *) D.2145_2;
  D.2124_3->_vptr.Foo ={v} &_ZTV3Foo[2];
  goto <bb 6>;

<bb 5>:
  deallocate (&v, 0B);

<bb 6>:
  # foo$ptr_16 = PHI <foo$ptr_18(ab)(5), D.2124_3(4)>
  foo$ptr_19(ab) = 0B;
  D.2147_6 = foo$ptr_16->_vptr.Foo;
  D.2148_7 = *D.2147_6;

but after apply inline it's wrong!?

<bb 3>:
  D.2145_2 = operator new (8);

<bb 4>:
  D.2124_3 = (struct Foo *) D.2145_2;
  D.2124_3->_vptr.Foo ={v} &_ZTV3Foo[2];

<bb 5>:
  # foo$ptr_16 = PHI <foo$ptr_18(ab)(2), D.2124_3(4)>
  foo$ptr_19(ab) = 0B;
  D.2147_6 = foo$ptr_19(ab)->_vptr.Foo;
  D.2148_7 = *D.2147_6;
  OBJ_TYPE_REF(D.2148_7;foo$ptr_19(ab)->0) (foo$ptr_19(ab));
  goto <bb 7>;


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|WAITING                     |NEW
          Component|c++                         |tree-optimization
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2007-09-27 21:03:18
               date|                            |
            Summary|wrong code with -O          |[4.3 Regression] wrong code
                   |                            |with -O
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33572


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

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-27 16:03 [Bug c++/33572] New: " wouter dot vermaelen at scarlet dot be
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 ` rguenth at gcc dot gnu dot org [this message]
2007-09-27 21:19 ` [Bug tree-optimization/33572] [4.3 Regression] " 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=20070927210318.2721.qmail@sourceware.org \
    --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).