From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32079 invoked by alias); 19 Aug 2005 11:28:41 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 32043 invoked by uid 48); 19 Aug 2005 11:28:36 -0000 Date: Fri, 19 Aug 2005 11:35:00 -0000 Message-ID: <20050819112836.32042.qmail@sourceware.org> From: "pinskia at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050819092003.23477.avi@argo.co.il> References: <20050819092003.23477.avi@argo.co.il> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug middle-end/23477] [4.1 Regression] default-initializing array new expression uses makes stack usage go way up X-Bugzilla-Reason: CC X-SW-Source: 2005-08/txt/msg02204.txt.bz2 List-Id: ------- 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