This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/80944] redundant memcpy/memset with non-constant size 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: Fri, 02 Jun 2017 14:22:29 +0000
- Subject: [Bug tree-optimization/80944] redundant memcpy/memset with non-constant size not eliminated
- Auto-submitted: auto-generated
- References: <bug-80944-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80944
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
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 adding a constraint/assert
that s->s doesn't point at s. Let me look into that.