public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Gunther Vogel <gunther.vogel@gmx.net>
To: <gcc-gnats@gcc.gnu.org>
Subject: optimization/6019: doubled struct initialization
Date: Wed, 20 Mar 2002 09:16:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.33.0203201805140.2667-100000@whiterider.offline> (raw)


>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:


             reply	other threads:[~2002-03-20 17:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-20  9:16 Gunther Vogel [this message]
2002-12-06 16:04 bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0203201805140.2667-100000@whiterider.offline \
    --to=gunther.vogel@gmx.net \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).