1 // RUN: %clang_analyze_cc1 -analyzer-store=region -verify %s \
2 // RUN: -analyzer-checker=core \
3 // RUN: -analyzer-checker=unix \
4 // RUN: -analyzer-checker=core.uninitialized \
5 // RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true
7 typedef __typeof(sizeof(int)) size_t;
11 char stackBased1 (void) {
14 return buf
[1]; // expected-warning{{Undefined}}
17 char stackBased2 (void) {
20 return buf
[0]; // expected-warning{{Undefined}}
23 // Exercise the conditional visitor. Radar://10105448
24 char stackBased3 (int *x
) {
29 return buf
[1]; // expected-warning{{Undefined}}
34 char heapBased1 (void) {
35 char *buf
= malloc(2);
37 char result
= buf
[1]; // expected-warning{{undefined}}
42 char heapBased2 (void) {
43 char *buf
= malloc(2);
45 char result
= buf
[0]; // expected-warning{{undefined}}