[PATCH] D105974: [analyzer] Do not assume that all pointers have the same bitwidth as void*

Vince Bridgers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 14 17:43:47 PDT 2021


vabridgers added a comment.

Thanks for the updates, comments and the reproducer. I've added those in this update. If possible, I'd like to get this change accepted to avoid the crash we currently see, and I'll immediately follow up with the FIXMEs. Otherwise, I'll iterate quickly on the FIXMEs. - Vince



================
Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:718
+      QualType Ty = Sym->getType();
+      // FIXME: Why did we have references at this point?
+      // FIXME: Cleanup remainder of `getZeroWithPtrWidth ()`
----------------
NoQ wrote:
> I guess something like this?
> ```lang=c++
> void foo(int &x) {
>   int *p = &x; // 'p' is the same SVal as 'x'
>   bool b = p;
> }
> ```
> I think we should return a concrete `true` in the reference case. We already know that such symbol is true-ish but returning a concrete `true` might be easier on the solver.
I think this comment is addressed by changing the comment, and deferring a subsequent follow up. I'd like to get this change submitted to at least avoid the crash if possible? Otherwise, if needed, I'll iterate quickly on trying to return a concrete 'true' for the reference case. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105974/new/

https://reviews.llvm.org/D105974



More information about the cfe-commits mailing list