aaron.ballman added a comment. In D67122#1656205 <https://reviews.llvm.org/D67122#1656205>, @lebedev.ri wrote:
> In D67122#1656189 <https://reviews.llvm.org/D67122#1656189>, @aaron.ballman > wrote: > > > One fear I have with this is in expansions of the `offsetof` macro, where > > it is a common implementation strategy to cast a null pointer to be of the > > correct type when calculating member offsets. Do you think you will be able > > to distinguish between null pointer additions that the user wrote directly > > (which is UB) as opposed to null pointer additions that come from the > > implementation (which is not UB)? > > > Can you show a snippet on godbolt? https://godbolt.org/z/5DHL2E This will show that Clang has a `__builtin_offsetof()` that gets used. I'm worried about situations where there is no `__builtin_offsetof()` but the canonical reference implementation is used instead (which looks identical to what initializes `bad` in my link). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67122/new/ https://reviews.llvm.org/D67122 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits