This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/69971] repetitive code with __builtin_return_address with a large level
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 28 Aug 2017 15:34:57 +0000
- Subject: [Bug middle-end/69971] repetitive code with __builtin_return_address with a large level
- Auto-submitted: auto-generated
- References: <bug-69971-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69971
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Yes, the warning does exist to warn about unsafe calls to the function (I added
it here: https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01702.html). This bug
was meant to suggest a way to make the built-in safer by expanding it as a loop
rather than stream of repetitive load instructions, while also making the code
more space efficient. But emitting a loop alone with no other checks (except
for the level) won't actually make the function safer. The loop would also
have to validate the address at each iteration. I'm not sure how easy,
efficient, or reliable this might be. In the of a corrupted stack it certainly
wouldn't be reliable.