[PATCH] D35041: [analyzer] Fix modeling of bool based types

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 11:25:19 PDT 2017


NoQ added a comment.

In https://reviews.llvm.org/D35041#801073, @alexshap wrote:

> evalCastFromNonLoc is actually called there (and that's how i ran into this issue) because of (a bit unexpected to me) ImplicitCastExpr 'LValueToRValue' inside switch


Yeah, but the `NonLoc` that's being casted is definitely not `nonloc::LocAsInteger`.
And i also tried to run your test with only `BasicValueFactory` fix and it passed.

In https://reviews.llvm.org/D35041#801073, @alexshap wrote:

> evalCastFromLoc - that's hard to me - so far i have not found a valid compilable c++ code to cast a pointer to bool enum.


I didn't see if that's exactly what we're looking for, but the following compiles and crashes:

  EnumBool E = static_cast<EnumBool>((intptr_t)nullptr);
  switch (E) {
  case EnumBool::F:
    return false;
  }
  return true;


Repository:
  rL LLVM

https://reviews.llvm.org/D35041





More information about the cfe-commits mailing list