Created attachment 25769 [details] 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.
Confirmed. The new death-point stuff doesn't help as the frontend does not seem to construct scopes properly for this testcase. ;; Function void Test() (null) ;; enabled by -tree-original <<cleanup_point <<< Unknown tree: expr_stmt (void) TARGET_EXPR <D.21343, <<< Unknown tree: aggr_init_expr 4 __comp_ctor D.21343 0B >>>> >>>>>; <<cleanup_point <<< Unknown tree: expr_stmt (void) TARGET_EXPR <D.21344, <<< Unknown tree: aggr_init_expr 4 __comp_ctor D.21344 0B >>>> >>>>>; ...
We already deal with cleanups for temporary objects, it should be pretty simple to add the death clobber that way.
Author: jason Date: Sun Nov 13 00:44:39 2011 New Revision: 181332 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181332 Log: PR c++/51060 * gimplify.c (gimplify_target_expr): Add a clobber to the cleanup. (gimplify_modify_expr): Don't try to simplify it. * cp/cp-gimplify.c (cp_gimplify_expr): Leave clobbers alone. Added: trunk/gcc/testsuite/g++.dg/opt/stack2.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-gimplify.c trunk/gcc/gimplify.c trunk/gcc/testsuite/ChangeLog trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/testsuite/25_algorithms/max/1.cc trunk/libstdc++-v3/testsuite/25_algorithms/min/1.cc trunk/libstdc++-v3/testsuite/25_algorithms/minmax/1.cc
Indeed, pretty simple now that we have that infrastructure.