[clang] Allow the no_stack_protector attribute on local variables (PR #173311)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 6 10:24:47 PST 2026


cooperp wrote:

> It's not clear to me whether we should do this only when NRVO is false.

Oh i didn't think about that one.  Certainly from the looks of the code in LLVM, we would generate a stack protector for large buffers used by NRVO.

I suspect we would want to allow this attribute in the NRVO case too, assuming that we can effectively trust/audit that writes to the given buffer are in range (maybe they are if the only one writing the buffer is compiler generated code not user written code?).

Either way, i don't have too strong an opinion.  @ahatanak what do you think? Could also punt NRVO until later if that helps?

https://github.com/llvm/llvm-project/pull/173311


More information about the cfe-commits mailing list