public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51060] New: Temporary object stack space is not re-used
@ 2011-11-09 14:11 andvgal at gmail dot com
  2011-11-09 14:46 ` [Bug c++/51060] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: andvgal at gmail dot com @ 2011-11-09 14:11 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/51060] Temporary object stack space is not re-used
  2011-11-09 14:11 [Bug c++/51060] New: Temporary object stack space is not re-used andvgal at gmail dot com
@ 2011-11-09 14:46 ` rguenth at gcc dot gnu.org
  2011-11-11 21:57 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-09 14:46 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-09
                 CC|                            |jason at redhat dot com,
                   |                            |matz at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-09 14:41:24 UTC ---
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 >>>> >>>>>;
...


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/51060] Temporary object stack space is not re-used
  2011-11-09 14:11 [Bug c++/51060] New: Temporary object stack space is not re-used andvgal at gmail dot com
  2011-11-09 14:46 ` [Bug c++/51060] " rguenth at gcc dot gnu.org
@ 2011-11-11 21:57 ` jason at gcc dot gnu.org
  2011-11-13  1:20 ` jason at gcc dot gnu.org
  2011-11-13  2:06 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-11 21:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-11 21:50:29 UTC ---
We already deal with cleanups for temporary objects, it should be pretty simple
to add the death clobber that way.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/51060] Temporary object stack space is not re-used
  2011-11-09 14:11 [Bug c++/51060] New: Temporary object stack space is not re-used andvgal at gmail dot com
  2011-11-09 14:46 ` [Bug c++/51060] " rguenth at gcc dot gnu.org
  2011-11-11 21:57 ` jason at gcc dot gnu.org
@ 2011-11-13  1:20 ` jason at gcc dot gnu.org
  2011-11-13  2:06 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-13  1:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-13 00:44:43 UTC ---
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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/51060] Temporary object stack space is not re-used
  2011-11-09 14:11 [Bug c++/51060] New: Temporary object stack space is not re-used andvgal at gmail dot com
                   ` (2 preceding siblings ...)
  2011-11-13  1:20 ` jason at gcc dot gnu.org
@ 2011-11-13  2:06 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-13  2:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-13 00:47:26 UTC ---
Indeed, pretty simple now that we have that infrastructure.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-13  0:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-09 14:11 [Bug c++/51060] New: Temporary object stack space is not re-used andvgal at gmail dot com
2011-11-09 14:46 ` [Bug c++/51060] " rguenth at gcc dot gnu.org
2011-11-11 21:57 ` jason at gcc dot gnu.org
2011-11-13  1:20 ` jason at gcc dot gnu.org
2011-11-13  2:06 ` jason at gcc dot gnu.org

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