Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -verify -analyze -checker-cfref -analyzer-store=region %s |
Ted Kremenek | 14553ab | 2009-01-30 00:08:43 +0000 | [diff] [blame] | 2 | |
| 3 | struct tea_cheese { unsigned magic; }; |
| 4 | typedef struct tea_cheese kernel_tea_cheese_t; |
| 5 | extern kernel_tea_cheese_t _wonky_gesticulate_cheese; |
| 6 | |
| 7 | // This test case exercises the ElementRegion::getRValueType() logic. |
| 8 | |
| 9 | |
| 10 | void foo( void ) |
| 11 | { |
| 12 | kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese; |
| 13 | struct load_wine *cmd = (void*) &wonky[1]; |
| 14 | cmd = cmd; |
| 15 | char *p = (void*) &wonky[1]; |
Ted Kremenek | 39abcdf | 2009-08-01 05:59:39 +0000 | [diff] [blame^] | 16 | *p = 1; // no-warning |
Zhongxing Xu | ccb1616 | 2009-05-06 08:08:27 +0000 | [diff] [blame] | 17 | kernel_tea_cheese_t *q = &wonky[1]; |
Ted Kremenek | 39abcdf | 2009-08-01 05:59:39 +0000 | [diff] [blame^] | 18 | // This test case tests both the RegionStore logic (doesn't crash) and |
| 19 | // the out-of-bounds checking. We don't expect the warning for now since |
| 20 | // out-of-bound checking is temporarily disabled. |
| 21 | kernel_tea_cheese_t r = *q; // eventually-warning{{out-of-bound memory position}} |
Ted Kremenek | 14553ab | 2009-01-30 00:08:43 +0000 | [diff] [blame] | 22 | } |