blob: d5fc2e0ff1bd361b5a6c7ef62e9b23494e384cff [file] [log] [blame]
Ted Kremenek8382cf52009-11-13 18:46:29 +00001// RUN: clang-cc -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic %s
Ted Kremenek14553ab2009-01-30 00:08:43 +00002
3struct tea_cheese { unsigned magic; };
4typedef struct tea_cheese kernel_tea_cheese_t;
5extern 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
11void 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}