public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/26388]  New: Variable sized storage allocation should be promoted to stack allocation
@ 2006-02-20 22:20 rguenth at gcc dot gnu dot org
  2006-02-20 22:21 ` [Bug tree-optimization/26388] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-20 22:20 UTC (permalink / raw)
  To: gcc-bugs

#include <vector>

void foo(int n)
{
        std::vector<int> v;
        for (int i=0; i<n; ++i)
                v.push_back(i);
}

here the (single) variable storage allocated on the heap can be promoted
to stack allocation, where the (single) object can grow dynamically.  This
happens in even more libstdc++ code and is generally exposed after inlining
only.

Note that due to the missing realloc primitive in C++, growing is done
as new + memmove pair, so detection of this case is somewhat harder.


-- 
           Summary: Variable sized storage allocation should be promoted to
                    stack allocation
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
 BugsThisDependsOn: 26387


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


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-26388-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2012-02-22 13:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-20 22:20 [Bug tree-optimization/26388] New: Variable sized storage allocation should be promoted to stack allocation rguenth at gcc dot gnu dot org
2006-02-20 22:21 ` [Bug tree-optimization/26388] " pinskia at gcc dot gnu dot org
2006-02-20 22:27 ` rguenth at gcc dot gnu dot org
2006-02-20 22:34 ` rguenth at gcc dot gnu dot org
2006-02-20 22:36 ` falk at debian dot org
2006-02-20 22:52 ` rguenther at suse dot de
2006-02-20 23:06 ` falk at debian dot org
2006-02-21  2:22 ` pinskia at gcc dot gnu dot org
     [not found] <bug-26388-4@http.gcc.gnu.org/bugzilla/>
2011-07-27 10:57 ` rguenth at gcc dot gnu.org
2012-02-22 13:37 ` xiaoyuanbo at yeah dot net

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