diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-09-01 23:00:46 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-09-01 23:00:46 +0000 |
commit | 1e4a32acfad6a9f4cf555fdbc5c6c44c558b9fcb (patch) | |
tree | b2f92470c4383d3cf141c4be7b5d707e56d90aee /test | |
parent | 710672485039d3dd355748876299fff88e8ad84c (diff) | |
download | clang-1e4a32acfad6a9f4cf555fdbc5c6c44c558b9fcb.tar.gz |
Don't assert in the analyzer when analyze code does a byte load from a function's address. Fixes PR 8052.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112761 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/misc-ps-region-store.m | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 38275335ee..8e84de1768 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -1066,3 +1066,27 @@ int r8258814() // Do not warn that the value of 'foo' is uninitialized. return foo; // no-warning } + +// PR 8052 - Don't crash when reasoning about loads from a function address.\n +typedef unsigned int __uint32_t; +typedef unsigned long vm_offset_t; +typedef __uint32_t pd_entry_t; +typedef unsigned char u_char; +typedef unsigned int u_int; +typedef unsigned long u_long; +extern int bootMP_size; +void bootMP(void); +static void +pr8052(u_int boot_addr) +{ + int x; + int size = *(int *) ((u_long) & bootMP_size); + u_char *src = (u_char *) ((u_long) bootMP); + u_char *dst = (u_char *) boot_addr + ((vm_offset_t) ((((((((1 << +12) / (sizeof(pd_entry_t))) - 1) - 1) - (260 - 2))) << 22) | ((0) << 12))); + for (x = 0; + x < size; + ++x) + *dst++ = *src++; +} + |