[PATCH] D100037: [clang][UBSan] Passing underaligned pointer as a function argument is undefined behaviour
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 7 12:08:33 PDT 2021
rjmccall added a comment.
> Yes. We now have a motivational reason to do so, it wouldn't be "just expose the UB for the sake of miscompiling the program".
Nobody thinks you're proposing this just for the sake of miscompiling. We understand that there are optimization benefits to having this information. We just don't think you get to have this information in general, because of the de facto rules of the language. Knowing that argument pointers don't alias would also be valuable for optimization, but C doesn't guarantee that; this is not that different, it's just that the language rule is a self-imposed rule of our implementation instead of being written up in a standard.
Are you certain that knowing argument pointer alignment is the only way of achieving this optimization? That's surprising to me because I would expect that most optimizations would also need dereferenceability, which of course you can't get. And if you can see (and hoist) a load to infer dereferenceability then you can also infer alignment from that.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100037/new/
https://reviews.llvm.org/D100037
More information about the cfe-commits
mailing list