https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70140
--- Comment #11 from Wilco <wilco at gcc dot gnu.org> --- (In reply to Martin Liška from comment #10) > > > > > > Yep, I've noticed. It's strange for me why it's not working. I've just > > > asked > > > at GCC ML: https://gcc.gnu.org/ml/gcc/2017-07/msg00144.html > > > > It's marked as a tailcall so anything you generate afterwards will be > > ignored: > > Thanks, knowing that it was easy to fix ;) I'm going to test the patch and > will send it to mailing list. Well the new patch looks great - I tried it on GLIBC and it ends up generating better code than inlining mempcpy in the string header. In total 111 calls to mempcpy are turned into memcpy, and although there are 166 extra instructions (most add/mov to deal with the return value), there are just 12 extra callee-saves.