This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/33572] [4.3 Regression] wrong code with -O



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]