For this code:

struct X {double m; int x;};
struct Y {int y; short d;};
struct YY {int y; short d; char c;};

int foo(struct X *x,  struct Y *y)
{
  x->x =  0;
  y->y =  1;
  if (x->x != 0)
    abort ();
}

int foo_no(struct X *x,  struct YY *y)
{
  x->x =  0;
  y->y =  1;
  if (x->x != 0)
    abort ();
}

the "if" does not get optimized away (by the dom1 pass) for the "foo_no"
function, but it is optimized for "foo" 
The only difference between the 2 functions is that foo_no takes as a parameter
a pointer to a struct that has a "char" field that is not accessed in this
function.

It would be nice if both functions were optimized in the same way.


-- 
           Summary: adding unused char field inhibits optimization
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to