This is a known problem -- file it to keep track of it.

In the following example, stores at (1) -- the array initializers are partially
dead -- not sinked.

struct A{
  int a[100];
};

const struct A aa = {1,1,1};

int foo(int i)
{
     int s = 0;
     struct A a = {1,1,1}; // (1)

     if (i)
     {
       a  =  aa;

       s += a.a[i];
     }
     s += a.a[i];

     return s;
}


-- 
           Summary: Missing partial dead store elimination
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xinliangli at gmail dot com


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

Reply via email to