From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22087 invoked by alias); 25 Sep 2006 16:57:52 -0000 Received: (qmail 22066 invoked by uid 48); 25 Sep 2006 16:57:43 -0000 Date: Mon, 25 Sep 2006 16:57:00 -0000 Message-ID: <20060925165743.22065.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/29215] Unnecessary use of stack space In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "joerg at netbsd dot org" 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 X-SW-Source: 2006-09/txt/msg02354.txt.bz2 List-Id: ------- Comment #8 from joerg at netbsd dot org 2006-09-25 16:57 ------- > Second this is just a memcpy issue, short testcase: > #include > > char buf[21]; > > int main(void) > { > int a = 0xffffffff; > memcpy(buf, &a, 4); This creates two movl, one for a and one to buf. When duplicating the memcpy multiples times, it stays one for a and one for each memcpy. Manually inline the original testcase shows the same behaviour. I think the real problem is in this example a is written to the stack and not optimised away. For the original test case the lazy stack cleanup would explain the multiple assignments. -- joerg at netbsd dot org changed: What |Removed |Added ---------------------------------------------------------------------------- GCC host triplet| |i386--netbsdelf Keywords|missed-optimization | Known to fail|4.0.0 4.1.0 4.2.0 | Known to work|3.4.0 | Summary|[4.0/4.1/4.2 Regression] |Unnecessary use of stack |memcpy is not fully |space |optimized any more | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29215