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

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 20 16:46:00 GMT 2017


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=23094

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
For what it's worth, I first noticed it in the following (arguably more
compelling) test case:

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

struct A { char a[4]; };

void f (struct A *p)
{
  __builtin_strcpy (a, p->a);
  __builtin_strcpy (a, p->a);
  __builtin_strcpy (a, p->a);
}

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

f (struct A * p)
{
  char[4] * _1;

  <bb 2> [local count: 10000]:
  _1 = &p_2(D)->a;
  __builtin_strcpy (&a, _1);
  __builtin_strcpy (&a, _1);
  __builtin_strcpy (&a, _1);
  return;

}


More information about the Gcc-bugs mailing list