[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 19 11:12:39 PST 2024
zygoloid wrote:
As mentioned in the comment thread, I'd prefer to see this addressed by reversing the order in which we call `addDecl` versus add an offset. While it's a corner case, I think this change would cause us to start rejecting things like [this example](https://godbolt.org/z/5Pae6Ghd7) where we form a non-null pointer with no base in a constant-folded region. Currently, the subsequent member access (`->hardware_register_1`) is accepted, because it's not accessing a member of a null pointer -- it's accessing a member of an integral non-null pointer.
I don't know how important things like this example are, but they do at least seem useful in some cases.
https://github.com/llvm/llvm-project/pull/113885
More information about the cfe-commits
mailing list