[clang] [analyzer] Fix assertion failure in `CXXInstanceCall::getCXXThisVal` (PR #70837)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 4 02:27:17 PDT 2023


================
@@ -30,3 +30,24 @@ void test(int i) {
   clang_analyzer_dump(g4);
   // expected-warning at -1 {{&i [as 64 bit integer]}}
 }
+
+struct A {
+  int n;
+  void set(int x) {
+    n = x;
+  }
+};
+using ptr_size = decltype(sizeof(void *));
+void gh_69922(ptr_size p) {
+  // expected-warning-re at +1 {{(reg_${{[0-9]+}}<ptr_size p>) & 1U}}
+  clang_analyzer_dump(__builtin_bit_cast(A*, p & 1));
----------------
steakhal wrote:

Yes, that is to form a `SymExpr`, which is a `SymbolVal` (NonLoc) wrapping a `BO_And` `SymIntExpr` I think.

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


More information about the cfe-commits mailing list