This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/83041] New: redundant assignment from member array not eliminated


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83041

            Bug ID: 83041
           Summary: redundant assignment from member array not eliminated
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC eliminates the redundant assignments in f() but not in g().  Other
compilers (IBM XLC and Intel ICC, for example) eliminate them in both
functions.

$ cat c.c && gcc -O2 -S -Wall -fdump-tree-optimized=/dev/stdout c.c
char a[4];

struct A { char a[4]; };
struct B { char a[4], b[4]; };

void f (struct A *p)
{
  a[0] = p->a[0];
  a[0] = p->a[0];   // not eliminated
  a[0] = p->a[0];   // not eliminated
}

void g (struct B *p)
{
  a[0] = p->a[0];
  a[0] = p->a[0];   // eliminated
  a[0] = p->a[0];   // eliminated
}


;; Function f (f, funcdef_no=0, decl_uid=1897, cgraph_uid=0, symbol_order=1)

f (struct A * p)
{
  char _1;
  char _2;
  char _3;

  <bb 2> [local count: 10000]:
  _1 = p_5(D)->a[0];
  a[0] = _1;
  _2 = p_5(D)->a[0];
  a[0] = _2;
  _3 = p_5(D)->a[0];
  a[0] = _3;
  return;

}



;; Function g (g, funcdef_no=1, decl_uid=1900, cgraph_uid=1, symbol_order=2)

g (struct B * p)
{
  char _1;

  <bb 2> [local count: 10000]:
  _1 = p_3(D)->a[0];
  a[0] = _1;
  return;

}

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