[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 21 09:31:27 PST 2023


rjmccall wrote:

> From all of above, the only way void* and char* alias if they are compatible, but they are not:

Ah, you're right, I had misremembered this.  6.2.5p31 requires them to have the same representation as each other, and there's a footnote about this being meant to imply "interchangeability as arguments to functions, return values from functions, and members of unions", but it doesn't go so far as to make them formally compatible.  And even if we wanted to read that as implying a sort of semi-compatibility that ought to affect aliasing, the same paragraph goes on to say that all pointers to structs must have the same representation, and presumably we wouldn't want *that* to affect aliasing.

Alright, I withdraw that comment; it's not formally required.  We may need to be more conservative about the aliasing of `void*` l-values on practical grounds, but we can let that be informed by results on the ground.

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


More information about the cfe-commits mailing list