[Bug c++/51060] New: Temporary object stack space is not re-used

andvgal at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 9 14:11:00 GMT 2011


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

             Bug #: 51060
           Summary: Temporary object stack space is not re-used
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: andvgal@gmail.com


Created attachment 25769
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25769
10 tmp objects of 1KB in size produce 10KB frame

I've tried hard finding a related incident, the only one close to it is PR
16269, but its solution doesn't help.

Attached is a sample test, which allocates 10 temporary objects of 1KB size in
own blocks in the same function.

If compiled with "-Wframe-larger-than=2048 -Werror -Os" (-Oany) the following
warning is produced:
warning: the frame size of 10240 bytes is larger than 2048 bytes
[-Wframe-larger-than=]


In our case, function frames are blown away for 100+KB, what makes a code with
similar pattern absolutely unusable in embedded systems.


Reproduced on GCC 4.6.1 x86_64 @ Debian and custom built GCC 4.6.2 for ARM.
The same issue exists in GCC 4.3.x for ARM.



More information about the Gcc-bugs mailing list