Ted Kremenek | 8382cf5 | 2009-11-13 18:46:29 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic %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 | // All it tests is that it does not crash or do anything weird. |
| 9 | // The out-of-bounds-access on line 19 is caught using the region store variant. |
| 10 | |
| 11 | void foo( void ) |
| 12 | { |
| 13 | kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese; |
| 14 | struct load_wine *cmd = (void*) &wonky[1]; |
| 15 | cmd = cmd; |
| 16 | char *p = (void*) &wonky[1]; |
| 17 | *p = 1; |
| 18 | kernel_tea_cheese_t *q = &wonky[1]; |
| 19 | kernel_tea_cheese_t r = *q; // no-warning |
| 20 | } |