diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-11-27 23:05:37 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-11-27 23:05:37 +0000 |
commit | bd8a11e224c3ec6cbc4bb9b1fc70a8aa3a633e43 (patch) | |
tree | 3484cd2b37b3b5ca9436253cf3f352a6f62325dc /test | |
parent | 82c458ea76bf8f0981e3d1b5070c0b0e5878d784 (diff) | |
download | clang-bd8a11e224c3ec6cbc4bb9b1fc70a8aa3a633e43.tar.gz |
Provide stop-gap solution to crash reported in PR 14436.
This was also covered by <rdar://problem/12753384>. The static analyzer
evaluates a CXXConstructExpr within an initializer expression and
RegionStore doesn't know how to handle the resulting CXXTempObjectRegion
that gets created. We need a better solution than just dropping the
value, but we need to better understand how to implement the right
semantics here.
Thanks to Jordan for his help diagnosing the behavior here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168741 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/misc-ps-region-store.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Analysis/misc-ps-region-store.cpp b/test/Analysis/misc-ps-region-store.cpp index adbc5b1df0..6d43509cdd 100644 --- a/test/Analysis/misc-ps-region-store.cpp +++ b/test/Analysis/misc-ps-region-store.cpp @@ -633,3 +633,26 @@ void test_alloca_in_a_recursive_function(int p1) { test_alloca_in_a_recursive_function(1); test_alloca_in_a_recursive_function(2); } + +//===---------------------------------------------------------------------===// +// Random tests. +//===---------------------------------------------------------------------===// + +// Tests assigning using a C-style initializer to a struct +// variable whose sub-field is also a struct. This currently +// results in a CXXTempObjectRegion being created, but not +// properly handled. For now, we just ignore that value +// to avoid a crash (<rdar://problem/12753384>). +struct RDar12753384_ClassA { + unsigned z; +}; +struct RDar12753384_ClassB { + unsigned x; + RDar12753384_ClassA y[ 8 ] ; +}; +unsigned RDar12753384() { + RDar12753384_ClassB w = { 0x00 }; + RDar12753384_ClassA y[8]; + return w.x; +} + |