[Bug c++/23477] New: default-initializing array new expression uses memcpy() instead of memset(), bloats executable

avi at argo dot co dot il gcc-bugzilla@gcc.gnu.org
Fri Aug 19 09:21:00 GMT 2005


the program 
 
    int main() 
    { 
        new int[10000000](); 
    } 
 
generates a 40MB executable. it compiles into a memcpy() of 40MB of zeros into 
the newly-allocated array. 
 
tested at -O0 and -O3. 
 
gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)

-- 
           Summary: default-initializing array new expression uses memcpy()
                    instead of memset(), bloats executable
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: avi at argo dot co dot il
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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



More information about the Gcc-bugs mailing list