https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111805
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-10-14
Component|c++ |middle-end
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Anyways we have:
__builtin_memcpy (&v.D.38438._M_local_buf, "abc", 3);
_5 = &MEM[(struct basic_string *)_3(D)].D.38438._M_local_buf;
MEM[(struct _Alloc_hider *)_3(D)]._M_p = _5;
__builtin_memcpy (_5, &v.D.38438._M_local_buf, 3);
MEM[(struct basic_string *)_3(D)]._M_string_length = 3;
MEM[(char_type &)_3(D) + 19] = 0;
If we able to remove the first memcpy things would be just work I think ...