[Bug c++/90313] [8 Regression] Is an assignment elided with gcc7.3 -O2?
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Feb 25 09:51:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90313
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Richard Sandiford
<rsandifo@gcc.gnu.org>:
https://gcc.gnu.org/g:7a2f576c3b40eca0a846553af5b1dfb05d84eb71
commit r8-10056-g7a2f576c3b40eca0a846553af5b1dfb05d84eb71
Author: Richard Sandiford <richard.sandiford@arm.com>
Date: Fri Aug 9 09:37:55 2019 +0000
Reject tail calls that read from an escaped RESULT_DECL [PR90313]
In this PR we have two return paths from a function "map". The common
code sets <result> to the value returned by one path, while the other
path does:
<retval> = map (&<retval>, ...);
We treated this call as tail recursion, losing the copy semantics
on the value returned by the recursive call.
We'd correctly reject the same thing for variables:
local = map (&local, ...);
The problem is that RESULT_DECLs didn't get the same treatment.
2020-02-25 Richard Sandiford <richard.sandiford@arm.com>
gcc/
Backport from mainline
2019-08-09 Richard Sandiford <richard.sandiford@arm.com>
PR middle-end/90313
* tree-tailcall.c (find_tail_calls): Reject calls that might
read from an escaped RESULT_DECL.
gcc/testsuite/
PR middle-end/90313
* g++.dg/torture/pr90313.cc: New test.
More information about the Gcc-bugs
mailing list