diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-01-22 23:56:56 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-01-22 23:56:56 +0000 |
commit | 2e84257c699cd8e98462021b4848e76967ac831d (patch) | |
tree | e18aac7efe2a76d8402580bf8ab23354e94d40d5 | |
parent | 6f78c3b8b9343e7e9fbf2d457cccf00df6da5d47 (diff) |
For now, return UnknownVal() in RegionStore::getElementsSize() for AnonTypedRegions. It wasn't really doing the right thing and was crashing on rdar-6442306-1.m. This fix causes all path-sensitive test cases to pass with RegionStore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62816 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/RegionStore.cpp | 10 | ||||
-rw-r--r-- | test/Analysis/NoReturn.m | 5 | ||||
-rw-r--r-- | test/Analysis/rdar-6442306-1.m | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index ec801d47f2..48c11f3bbf 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -420,6 +420,12 @@ SVal RegionStoreManager::getSizeInElements(const GRState* St, } if (const AnonTypedRegion* ATR = dyn_cast<AnonTypedRegion>(R)) { +#if 0 + // FIXME: This logic doesn't really work, as we can have all sorts of + // weird cases. For example, this crashes on test case 'rdar-6442306-1.m'. + // The weird cases come in when arbitrary casting comes into play, violating + // any type-safe programming. + GRStateRef state(St, StateMgr); // Get the size of the super region in bytes. @@ -450,6 +456,10 @@ SVal RegionStoreManager::getSizeInElements(const GRState* St, (SSize * getBasicVals().getValue(8, SSize.getBitWidth(), false)) / ESize; return NonLoc::MakeVal(getBasicVals(), S); +#else + ATR = ATR; + return UnknownVal(); +#endif } if (const FieldRegion* FR = dyn_cast<FieldRegion>(R)) { diff --git a/test/Analysis/NoReturn.m b/test/Analysis/NoReturn.m index 16870f8aa1..2d3bd7c81e 100644 --- a/test/Analysis/NoReturn.m +++ b/test/Analysis/NoReturn.m @@ -1,5 +1,6 @@ -// RUN: clang -analyze -checker-simple -verify %s && -// RUN: clang -analyze -checker-cfref -verify %s +// RUN: clang -analyze -checker-simple -analyzer-store-basic -verify %s && +// RUN: clang -analyze -checker-cfref -analyzer-store-basic -verify %s && +// RUN: clang -analyze -checker-cfref -analyzer-store-region -verify %s #include <stdarg.h> diff --git a/test/Analysis/rdar-6442306-1.m b/test/Analysis/rdar-6442306-1.m index ea8d9baf6e..b3235d9c40 100644 --- a/test/Analysis/rdar-6442306-1.m +++ b/test/Analysis/rdar-6442306-1.m @@ -1,5 +1,5 @@ -// RUN: clang -analyze -checker-cfref %s --analyzer-store-basic -verify -// DISABLE: clang -analyze -checker-cfref %s --analyzer-store-region -verify +// RUN: clang -analyze -checker-cfref %s --analyzer-store-basic -verify && +// RUN: clang -analyze -checker-cfref %s --analyzer-store-region -verify typedef int bar_return_t; typedef struct { |