From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28631 invoked by alias); 20 Mar 2002 17:16:12 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 28526 invoked by uid 71); 20 Mar 2002 17:16:05 -0000 Resent-Date: 20 Mar 2002 17:16:03 -0000 Resent-Message-ID: <20020320171603.28519.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, Gunther Vogel Received:(qmail 22659 invoked from network); 20 Mar 2002 17:06:43 -0000 Received: from unknown (HELO f2node23.rhrz.uni-bonn.de) (131.220.14.223) by sources.redhat.com with SMTP; 20 Mar 2002 17:06:43 -0000 Received: from whiterider.offline (ascend-tk-p111.dialin.uni-bonn.de [131.220.244.111]) by f2node23.rhrz.uni-bonn.de (AIX4.3/8.9.3/8.9.3) with ESMTP id SAA10634 for ; Wed, 20 Mar 2002 18:06:40 +0100 Received: from localhost (localhost [127.0.0.1]) by whiterider.offline (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id g2KH5qW02674 for ; Wed, 20 Mar 2002 18:05:52 +0100 Message-Id: Date: Wed, 20 Mar 2002 09:16:00 -0000 From: Gunther Vogel To: Subject: optimization/6019: doubled struct initialization X-SW-Source: 2002-03/txt/msg00760.txt.bz2 List-Id: >Number: 6019 >Category: optimization >Synopsis: doubled struct initialization >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Wed Mar 20 09:16:02 PST 2002 >Closed-Date: >Last-Modified: >Originator: Gunther Vogel >Release: 3.0.4 >Organization: >Environment: System: Linux whiterider 2.4.17 #10 Tue Feb 26 17:24:09 CET 2002 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ./configure --prefix=/usr/src/packages/BUILD/gccgpp-buildroot/usr --mandir=/share/man --with-cpu=athlon --disable-cpp --disable-nls >Description: The first generated movl $2538, ... instructions looks superfluous to me. This effect occurs if and only if optimization (gcc -O[1-3] -S t.c) is used. Using different -march= options (i[3-6]86, athlon) moves things around a bit, but keeps the repetition. (Please take my apology if this is just some kind of subtle optimization I don't comprehend.) >How-To-Repeat: // begin file t.c typedef struct B_ { int b; } B; extern void bar(B*); void foo() { B b = { 2538 }; bar(&b); } // end file t.c // begin excerpt t.s generated by gcc -O2 -S t.c foo: pushl %ebp movl %esp, %ebp subl $20, %esp movl $2538, -4(%ebp) leal -8(%ebp), %eax movl $2538, -8(%ebp) pushl %eax call bar movl %ebp, %esp popl %ebp ret // end excerpt t.s >Fix: unknown >Release-Note: >Audit-Trail: >Unformatted: