[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 13 15:18:20 PDT 2025


efriedma-quic wrote:

Just ran into some related code: see 3d0a540857edbd510e329f40581f6b2c1968ccca .  Maybe using IgnoreParenCasts() like that code does is appropriate.  (I don't really like using IgnoreParenCasts() because there's such a big variety of casts, but it's probably okay in this context.)

> > Do you care at all about patterns like ((uintptr_t)(&(((S *)nullptr)->y.z)));?
> 
> Yes. This pattern is used by openssl.

Note this has two MemberExprs, so if you want to handle this, you'll have to look through the MemberExpr when you're generating the second GEP, I think.

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


More information about the cfe-commits mailing list