optimization/8725: spurious stack adjustment

dann@godzilla.ics.uci.edu dann@godzilla.ics.uci.edu
Tue Nov 26 17:06:00 GMT 2002


>Number:         8725
>Category:       optimization
>Synopsis:       spurious stack adjustment
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 26 15:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     dann@godzilla.ics.uci.edu
>Release:        CVS
>Organization:
>Environment:
i386-pc-linux-gnu
>Description:
This is a regression from egcs-1.1.2

When compiling the following code with -O2 -S -fomit-frame-pointer
with CVS gcc as of today

struct boo {
  int a;
  int aa;
};


int foo (void);

int bar (void)
{
  struct boo cucu;
  cucu.a = 1;
  foo();
  cucu.a++;
  return 0;
}


the following is generated: 

bar:
        subl    $12, %esp
        call    foo
        xorl    %eax, %eax
        addl    $12, %esp
        ret

Note the extra subl and addl instructions. 

When doing the same thing on an old RedHad-6.2 machine that
has egcs-1.1.2 the generated code is: 

bar:
        call foo
        xorl %eax,%eax
        ret

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list