diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-05-09 15:34:29 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-05-09 15:34:29 +0000 |
commit | 5bf3287765d14b5c6666bd00d0a141b0a6c97a20 (patch) | |
tree | f413e49ca9cdfd40fddbf0eb1ca61a8527260007 | |
parent | 75eb5baa374316f54785a0f4c83809536ac9421c (diff) |
When casting VarRegion, if the var type is aggregate type and the cast-to
pointee type is scalar type, create element region regardless with the sizes
of types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71360 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/RegionStore.cpp | 3 | ||||
-rw-r--r-- | test/Analysis/fields.c | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 0fc24a9a2b..a66e63c877 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -616,7 +616,8 @@ RegionStoreManager::CastRegion(const GRState* state, const MemRegion* R, uint64_t PointeeTySize = getContext().getTypeSize(PointeeTy); uint64_t ObjTySize = getContext().getTypeSize(ObjTy); - if (PointeeTySize > 0 && PointeeTySize < ObjTySize) { + if ((PointeeTySize > 0 && PointeeTySize < ObjTySize) || + (ObjTy->isAggregateType() && PointeeTy->isScalarType())) { // Record the cast type of the region. state = setCastType(state, R, ToTy); diff --git a/test/Analysis/fields.c b/test/Analysis/fields.c index 8b88578a0e..c012a9da7b 100644 --- a/test/Analysis/fields.c +++ b/test/Analysis/fields.c @@ -1,6 +1,5 @@ // RUN: clang-cc -analyze -checker-cfref %s --analyzer-store=basic -verify && // RUN: clang-cc -analyze -checker-cfref %s --analyzer-store=region -verify -// XFAIL unsigned foo(); typedef struct bf { unsigned x:2; } bf; |