[Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register

giovannibajo at libero dot it gcc-bugzilla@gcc.gnu.org
Mon Feb 14 11:36:00 GMT 2005


----------------------------
int a;
void foo(void)
{
  a = 10;
}
----------------------------

when compiled with GCC 4.0 20050118, with -O2 -fomit-frame-pointer, generates 
the following code:

foo:
        movl    $10, %eax
        movl    %eax, a
        ret

Notice the unnecessary which wastes a register.  With 3.4, we get the expected 
code:

foo:
        movl    $10, a
        ret

-- 
           Summary: [4.0 Regression] inefficient store of constant into a
                    global register
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: giovannibajo at libero dot it
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: x86-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19945



More information about the Gcc-bugs mailing list