https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122727
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to M Welinder from comment #6) > I don't think sorting out the pointer aliases is going to do much here. To > see that, let's side step it completely and consider the code you would have > if you somehow managed to optimize the temporaries away: Except that still has aliasing issues because of escaping is not flow sensative in GCC: MEM[(struct basic_string *)res_5(D)]._M_string_length = _100; _107 = MEM[(const struct basic_string *)res_5(D)]._M_dataplus._M_p; _108 = _107 + _100; MEM[(char_type &)_108] = 0; __sz_146 = MEM[(const struct basic_string *)res_5(D)]._M_string_length; So there is still some aliasing issues.
