From 35dcad8aeef4fc499ab4f057cf40a5da3cc0ee45 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 24 Sep 2009 06:24:32 +0000 Subject: [PATCH] Fix crash in RegionStoreManager::Bind() by using 'getAs()' instead of 'cast()' (to handle pointer typedefs). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82686 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/RegionStore.cpp | 2 +- test/Analysis/misc-ps-region-store.m | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 31f52a55b3..75907da55e 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -1322,7 +1322,7 @@ const GRState *RegionStoreManager::Bind(const GRState *state, Loc L, SVal V) { // Binding directly to a symbolic region should be treated as binding // to element 0. QualType T = SR->getSymbol()->getType(getContext()); - T = cast(T)->getPointeeType(); + T = T->getAs()->getPointeeType(); R = GetElementZeroRegion(SR, T); } diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 569fc790d6..c5be02c821 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -198,7 +198,8 @@ CGFloat rdar7242006_negative(CGFloat x) { // - Allow binding of values to symbolic regions. // This test case shows how RegionStore tracks the value bound to 'x' // after the assignment. -void rdar_7249340(int *x) { +typedef int* ptr_rdar_7249340; +void rdar_7249340(ptr_rdar_7249340 x) { *x = 1; if (*x) return; -- 2.50.1