This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/87011] New: [9 Regression] partially dead memset before strcpy not eliminated
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 18 Aug 2018 21:54:40 +0000
- Subject: [Bug tree-optimization/87011] New: [9 Regression] partially dead memset before strcpy not eliminated
- Auto-submitted: auto-generated
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;
}