[Bug c++/16269] g++ doesn't reuse stack space

rth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Sep 4 00:06:00 GMT 2004


------- Additional Comments From rth at gcc dot gnu dot org  2004-09-04 00:06 -------
No, not related to 9997.  In this case we have 

  struct A <D1614>;
  struct A <D1615>;
  ...                                                                              
  <D1614> = foo ();
  operator= (&a, &<D1614>);
  <D1615> = foo ();
  operator= (&a, &<D1615>);

These two compiler temporaries are in the same scope, and thus the code that
lays out stack space will not be given an opportunity to share the memory.
In order for this to work as you expect, the front end would have to be 
changed to generate

  {
    struct A <D1614>;
    <D1614> = foo ();
    operator= (&a, &<D1614>);
  }
  {
    struct A <D1615>;
    <D1615> = foo ();
    operator= (&a, &<D1615>);
  }

In other words, be more explicit about the lifetimes of the temporaries
that it creates.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-07-10 02:50:38         |2004-09-04 00:06:38
               date|                            |


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



More information about the Gcc-bugs mailing list