[clang] [Clang] Mark new as inaccessiblememonly if sane (PR #197199)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Fri May 29 21:43:38 PDT 2026
ojhunt wrote:
> Opened #200367 to make use of the struct TBAA
>
> > That seems reasonable, even though most operator new impls use malloc under the hood, it's unlikely anyone calling new is ever going to caring about the errno impact :D
>
> Dropping the `errnomem: write` would be another option, which would avoid this issue entirely. We did recently add this to malloc though, so we should probably at least try to respect it for new, though the case is weaker there...
I think it's more reasonable to that anything with struct based TBAA cannot alias errno - I'd want to be even stricter and say anything other than `decltype(errno)*` isn't aliasing errno, which I recognize is incorrect w.r.t to the standard type aliasing rules, but it feels like passing pointers to errno via the wrong type must surely be uncommon? (I haven't ever seen code the passes errno around by address in general, but unlike an llm I didn't need to learn to program by copying the entire body of all code that has ever been written :D)
https://github.com/llvm/llvm-project/pull/197199
More information about the cfe-commits
mailing list