This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/6019: doubled struct initialization



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]