https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61769
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
Severity|major |normal
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The for loop just causes the program to reuse the stack memory where the
std::abs return slots were, so the memory where the dangling reference points
gets modified and you see the value change.