rdar-6541136-region.c revision 39abcdf1c7dfc4fd2bda57416812672830400c9e
1// RUN: clang-cc -verify -analyze -checker-cfref -analyzer-store=region %s 2 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 9 10void 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]; 16 *p = 1; // no-warning 17 kernel_tea_cheese_t *q = &wonky[1]; 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}} 22} 23