[PATCH] D56760: Add a new builtin: __builtin_dynamic_object_size

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 23 10:22:33 PST 2019


erik.pilkington added a comment.

In D56760#1367915 <https://reviews.llvm.org/D56760#1367915>, @jfb wrote:

> @rsmith, what do you think and how do you want to proceed? We think something like what Erik implemented will catch things `_FORTIFY_SOURCE` currently cannot. We agree there are valid code generation complexity concerns, yet it seems like having a different spelling for the builtin helps mitigate those concerns.


Yeah, I think the codegen explosion concerns are somewhat valid. It seems like for the most part its just a matter of keeping a value alive or doing a multiply or add here or there, which doesn't seem like the end of the world if its opt-in. The kind of pathological expressions that this is addressing seems like exactly the places where you would want the extra dynamic checks, like where you're indexing into an object with dynamically computed value with weird control flow or something. That being said, we could probably bail out of folding this in LLVM if the expression gets too complex.

So it seems like the GCC people want to keep `__builtin_object_size` static. In that case, I think that this current patch is the way to go. I'll post a patch to fix up pass_object_size too.

Thanks @jfb!


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56760/new/

https://reviews.llvm.org/D56760





More information about the cfe-commits mailing list