public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19817] New: C++ front-end produces a cast instead of just &a.b (when call the deconstructor)
@ 2005-02-08 15:09 pinskia at gcc dot gnu dot org
  2005-02-20 19:34 ` [Bug c++/19817] " pinskia at gcc dot gnu dot org
  2005-03-10 18:17 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-08 15:09 UTC (permalink / raw)
  To: gcc-bugs

The following code should be optimizated out on the tree level but is not because we have a cast 
involved when calling the deconstuctor.
int t;
struct base { int i; ~base(){t = i;}};
struct vector : public base { vector(){ i = 2; }};
int f() { vector v; return t;}

extern "C" void abort ();

int main(void)
{
  t = 2;
  if (f() != 2)
   link_error ();
  if (t!= 2)
   link_error ();
  return 0;
}

This might be the case for PR 19786 but I don't know for sure.

-- 
           Summary: C++ front-end produces a cast instead of just &a.b (when
                    call the deconstructor)
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/19817] C++ front-end produces a cast instead of just &a.b (when call the deconstructor)
  2005-02-08 15:09 [Bug c++/19817] New: C++ front-end produces a cast instead of just &a.b (when call the deconstructor) pinskia at gcc dot gnu dot org
@ 2005-02-20 19:34 ` pinskia at gcc dot gnu dot org
  2005-03-10 18:17 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-20 19:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-20 14:18 -------
Confirmed,  This seems stupid the front-end is doing this as casts get in the way of optimizations now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-20 14:18:33
               date|                            |


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/19817] C++ front-end produces a cast instead of just &a.b (when call the deconstructor)
  2005-02-08 15:09 [Bug c++/19817] New: C++ front-end produces a cast instead of just &a.b (when call the deconstructor) pinskia at gcc dot gnu dot org
  2005-02-20 19:34 ` [Bug c++/19817] " pinskia at gcc dot gnu dot org
@ 2005-03-10 18:17 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-10 18:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-10 18:17 -------
The bug is in convert_to_base_statically.

-- 


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-10 18:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-08 15:09 [Bug c++/19817] New: C++ front-end produces a cast instead of just &a.b (when call the deconstructor) pinskia at gcc dot gnu dot org
2005-02-20 19:34 ` [Bug c++/19817] " pinskia at gcc dot gnu dot org
2005-03-10 18:17 ` pinskia at gcc dot gnu dot org

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