------- 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 via email to