[Bug tree-optimization/80944] redundant memcpy/memset with non-constant size not eliminated

2017-06-02 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80944 --- Comment #3 from Martin Sebor --- Good point! It never occurred to me. That explains why no compiler does it. That suggests that the optimization opportunity is up to the user. I.e., a class like std::string could optimize this case by

[Bug tree-optimization/80944] redundant memcpy/memset with non-constant size not eliminated

2017-06-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80944 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug tree-optimization/80944] redundant memcpy/memset with non-constant size not eliminated

2017-06-01 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80944 --- Comment #1 from Marc Glisse --- (In reply to Martin Sebor from comment #0) > struct S { char *s; unsigned n; }; > > void f (struct S *s) > { > __builtin_memset (s->s, 0, s->n); > __builtin_free (s->s); > __builtin_memset (s, 0, sizeof