This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16269] g++ doesn't reuse stack space
- From: "rth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Sep 2004 00:06:41 -0000
- Subject: [Bug c++/16269] g++ doesn't reuse stack space
- References: <20040629144215.16269.mrs@apple.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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