public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/23477] [4.1 Regression] default-initializing array new expression uses makes stack usage go way up
Date: Fri, 19 Aug 2005 11:35:00 -0000	[thread overview]
Message-ID: <20050819112836.32042.qmail@sourceware.org> (raw)
In-Reply-To: <20050819092003.23477.avi@argo.co.il>


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-19 11:28 -------
This has been semi fixed on the mainline:
main:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %esi
        pushl   %ebx
        subl    $40000000, %esp
        pushl   $40000000
        call    _Znaj
        leal    -40000008(%ebp), %ebx
        pushl   $40000000
        pushl   $0
        pushl   %ebx
        movl    %eax, %esi
        call    memset
        pushl   $40000000
        pushl   %ebx
        pushl   %esi
        call    memcpy
        leal    -8(%ebp), %esp
        xorl    %eax, %eax
        popl    %ebx
        popl    %esi
        popl    %ebp
        ret

But in fact this is worse as the reason for the heap allocation is to avoid  the stack usage at all and now 
there is 40MB allocated on the stack.

The problem is in the middle-end:
  *(int[10000000] *) D.1731 = {};


Note the memcpy is an improvement over what before 4.0.0 had of writting out element by element.

4.1's problem is a regression in terms of stack usage which should not have happen.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |middle-end
     Ever Confirmed|                            |1
  GCC build triplet|i386-redhat-linux           |
   GCC host triplet|i386-redhat-linux           |
 GCC target triplet|i386-redhat-linux           |
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-19 11:28:34
               date|                            |
            Summary|default-initializing array  |[4.1 Regression] default-
                   |new expression uses memcpy()|initializing array new
                   |instead of memset(), bloats |expression uses makes stack
                   |executable                  |usage go way up
   Target Milestone|---                         |4.1.0


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


  reply	other threads:[~2005-08-19 11:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-19  9:21 [Bug c++/23477] New: default-initializing array new expression uses memcpy() instead of memset(), bloats executable avi at argo dot co dot il
2005-08-19 11:35 ` pinskia at gcc dot gnu dot org [this message]
2005-08-30 10:44 ` [Bug middle-end/23477] [4.1 Regression] default-initializing array new expression uses makes stack usage go way up pinskia at gcc dot gnu dot org
2005-08-30 11:53 ` rguenth at gcc dot gnu dot org
2005-08-30 13:31 ` rguenth at gcc dot gnu dot org
2005-08-31 11:22 ` cvs-commit at gcc dot gnu dot org
2005-08-31 11:43 ` rguenth at gcc dot gnu dot org
     [not found] <bug-23477-10612@http.gcc.gnu.org/bugzilla/>
2006-01-20 20:51 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050819112836.32042.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).