[PATCH] D99791: [CGCall] Annotate pointer argument with alignment

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 3 00:18:19 PDT 2021


lebedev.ri added a comment.

@efriedma thank you for taking a look!
I agree that D99790 <https://reviews.llvm.org/D99790> is basically guaranteed safe, and this "probably" isn't.

In D99791#2667047 <https://reviews.llvm.org/D99791#2667047>, @efriedma wrote:

> This feels scary: the C standard technically allows this, but we haven't done it in the past, and it could break otherwise functioning code.  (We've only assumed alignment about pointers that are dereferenced/dereferenceable.)

I can add necessary UBSan plumbing beforehand, iff we can actually do this.

> For D99790 <https://reviews.llvm.org/D99790>, we're already marking the pointer dereferenceable, so also marking the alignment seems like a small extra step.  (Really, it's a regression fix; we used to treat dereferenceable as implying alignment. I guess I missed a spot when I was fixing that.)

Yep. Feel like stamping that one? :)

> But here, we're not assuming it's dereferenceable at the moment.  So there's more potential to break code, and also the potential benefit is small.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99791



More information about the cfe-commits mailing list