blob: 844a9367b4313305ea3acdd79083f8c59c256d63 [file] [log] [blame]
Ted Kremenek565e4652010-02-05 02:06:54 +00001// RUN: %clang_cc1 -verify -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -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}