]> granicus.if.org Git - clang/commitdiff
Also treat the type of the subexpression as a pointer in GRExprEngine::VisitCast...
authorTed Kremenek <kremenek@apple.com>
Wed, 23 Dec 2009 01:19:20 +0000 (01:19 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 23 Dec 2009 01:19:20 +0000 (01:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91969 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/GRExprEngine.cpp
test/Analysis/misc-ps-region-store.cpp

index 6e77b6b103820d6f8f23cc36530a0ac523debe1e..c26867bf5401e5e2fd2c9c25c822ff8ba36987c4 100644 (file)
@@ -2125,6 +2125,7 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, ExplodedNode* Pred,
   if (asLValue) {
     ASTContext &Ctx = getContext();
     T = Ctx.getPointerType(Ctx.getCanonicalType(T));
+    ExTy = Ctx.getPointerType(Ctx.getCanonicalType(ExTy));
   }
 
   for (ExplodedNodeSet::iterator I = S2.begin(), E = S2.end(); I != E; ++I) {
index e1750139c2ffb9a95a66314daee990a821468b32..be150c92cc346f4688e60aecb3c0f6bef1f6a5ac 100644 (file)
@@ -23,3 +23,14 @@ int test2_b_aux(const short &n);
 int test2_b(int n) {
   return test2_b_aux(n);
 }
+
+// Test getting the lvalue of a derived and converting it to a base.  This
+// previously crashed.
+class Test3_Base {};
+class Test3_Derived : public Test3_Base {};
+
+int test3_aux(Test3_Base &x);
+int test3(Test3_Derived x) {
+  return test3_aux(x);
+}
+