https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69971
--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #2) > 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. I dunno, it still doesn't really seem worth it to try to improve code that a warning is already discouraging users from writing... it seems like it would be easier simply to never write __builtin_return_address(1024) in the first place rather than trying to change how the compiler handles it.