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/87011] New: [9 Regression] partially dead memset before strcpy not eliminated


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

            Bug ID: 87011
           Summary: [9 Regression] partially dead memset before strcpy not
                    eliminated
           Product: gcc
           Version: 9.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: ---

In released versions of GCC the memset call would be optimized by DSE to memset
(_6, 0, 12).  On trunk, however, this is not done:

$ cat f.c && gcc -O2 -S -Wall -fdump-tree-optimized=/dev/stdout f.c
struct S { char a[4]; void (*pf)(void); };

void f (struct S *p)
{
  __builtin_memset (p, 0, sizeof *p);
  __builtin_strcpy (p->a, "123");
}
;; dump 228: optimized (enabled by -ftree-optimized)
;; Function f (f, funcdef_no=0, decl_uid=1910, cgraph_uid=1, symbol_order=0)

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

  <bb 2> [local count: 1073741825]:
  __builtin_memset (p_3(D), 0, 16);
  _1 = &p_3(D)->a;
  __builtin_memcpy (_1, "123", 4); [tail call]
  return;
}

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