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 c++/16269] g++ doesn't reuse stack space


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


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