Changeset View
Changeset View
Standalone View
Standalone View
test/Analysis/out-of-bounds.c
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void test3(int x) { | void test3(int x) { | ||||
int buf[100]; | int buf[100]; | ||||
if (x < 0) | if (x < 0) | ||||
buf[x] = 1; // expected-warning{{Out of bound memory access}} | buf[x] = 1; // expected-warning{{Out of bound memory access}} | ||||
} | } | ||||
void test3_simplified_offset(int x, unsigned long long y) { | |||||
int buf[100]; | |||||
if (x < 0) | |||||
x = 0; | |||||
for (int i = y - x; i > 0 && i < 100; i++) | |||||
buf[i] = 0; // no-warning | |||||
} | |||||
void test4(int x) { | void test4(int x) { | ||||
int buf[100]; | int buf[100]; | ||||
if (x > 99) | if (x > 99) | ||||
buf[x] = 1; // expected-warning{{Out of bound memory access}} | buf[x] = 1; // expected-warning{{Out of bound memory access}} | ||||
} | } | ||||
void test_assume_after_access(unsigned long x) { | void test_assume_after_access(unsigned long x) { | ||||
int buf[100]; | int buf[100]; | ||||
Show All 30 Lines |