diff options
| author | Ted Kremenek <kremenek@apple.com> | 2011-01-13 06:58:15 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2011-01-13 06:58:15 +0000 |
| commit | 304b6e4aa11126919a1bf5c8ab1c5b7a334573c4 (patch) | |
| tree | 7c887e2b755c6420f7d7a7b7c850099bb0cbe507 /clang/test/Analysis | |
| parent | da2d2f4d1f960f40f62fdbf011eae8fef8c83496 (diff) | |
| download | bcm5719-llvm-304b6e4aa11126919a1bf5c8ab1c5b7a334573c4.tar.gz bcm5719-llvm-304b6e4aa11126919a1bf5c8ab1c5b7a334573c4.zip | |
Fix a corner case in RegionStore where we assign
a struct value to a symbolic index into array.
RegionStore can't actually reason about this,
so we were getting bogus warnings about loading
uninitialized values from the array. The solution
is invalidate the entire array when we cannot
represent the binding explicitly.
Fixes <rdar://problem/8848957>
llvm-svn: 123368
Diffstat (limited to 'clang/test/Analysis')
| -rw-r--r-- | clang/test/Analysis/misc-ps-region-store.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Analysis/misc-ps-region-store.m b/clang/test/Analysis/misc-ps-region-store.m index 0a6884be063..13a2c1fbe9a 100644 --- a/clang/test/Analysis/misc-ps-region-store.m +++ b/clang/test/Analysis/misc-ps-region-store.m @@ -1203,3 +1203,17 @@ void rdar_8642434_funcB(struct rdar_8642434_typeA *x, struct rdar_8642434_typeA rdar_8642434_funcA(y); // expected-warning{{Null pointer passed as an argument to a 'nonnull' parameter}} } +// <rdar://problem/8848957> - Handle loads and stores from a symbolic index +// into array without warning about an uninitialized value being returned. +// While RegionStore can't fully reason about this example, it shouldn't +// warn here either. +typedef struct s_test_rdar8848957 { + int x, y, z; +} s_test_rdar8848957; + +s_test_rdar8848957 foo_rdar8848957(); +int rdar8848957(int index) { + s_test_rdar8848957 vals[10]; + vals[index] = foo_rdar8848957(); + return vals[index].x; // no-warning +} |

