tweak synthetic tests
This commit is contained in:
parent
506d1ed68d
commit
6e9346323c
|
@ -9,93 +9,116 @@ int getValue(void); // unknown int value
|
||||||
// arg
|
// arg
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
|
|
||||||
void bug_arg_in_if(int a) {
|
void arg_in_if(int a) {
|
||||||
if (a>=__LINE__)
|
if (a>=100)
|
||||||
buf[a] = 0; // BUG
|
buf[a] = 0; // BUG
|
||||||
}
|
}
|
||||||
|
|
||||||
void bug_arg_before_if(int a) {
|
void arg_before_if(int a) {
|
||||||
buf[a] = 0; // BUG
|
buf[a] = 0; // WARNING
|
||||||
if (a==__LINE__) {}
|
if (a==100) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bug_arg_after_if(int a) {
|
void arg_after_if(int a) {
|
||||||
if (a==__LINE__) {}
|
if (a==100) {}
|
||||||
buf[a] = 0; // BUG
|
buf[a] = 0; // WARNING
|
||||||
}
|
}
|
||||||
|
|
||||||
// var
|
// var
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
|
|
||||||
void bug_var(void) {
|
void var(void) {
|
||||||
int x = __LINE__;
|
int x = 100;
|
||||||
buf[x] = 0; // BUG
|
buf[x] = 0; // BUG
|
||||||
}
|
}
|
||||||
|
|
||||||
void bug_var_in_switch(void) {
|
void var_in_for(void) {
|
||||||
|
int x;
|
||||||
|
for (x = 0; x<100; x++) {
|
||||||
|
buf[x] = 0; // BUG
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void var_after_for(void) {
|
||||||
|
int x;
|
||||||
|
for (x = 0; x<100; x++) {}
|
||||||
|
buf[x] = 0; // BUG
|
||||||
|
}
|
||||||
|
|
||||||
|
void var_in_switch(void) {
|
||||||
int x = getValue();
|
int x = getValue();
|
||||||
switch (x) {
|
switch (x) {
|
||||||
case __LINE__:
|
case 100:
|
||||||
buf[x] = 0; // BUG
|
buf[x] = 0; // BUG
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bug_var_after_switch(void) {
|
void var_before_switch(void) {
|
||||||
int x = getValue();
|
int x = getValue();
|
||||||
|
buf[x] = 0; // WARNING
|
||||||
switch (x) {
|
switch (x) {
|
||||||
case __LINE__:
|
case 100:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
buf[x] = 0; // BUG
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bug_var_after_while(void) {
|
void var_after_switch(void) {
|
||||||
int x = 0;
|
int x = getValue();
|
||||||
while (x<=__LINE__)
|
switch (x) {
|
||||||
x++;
|
case 100:
|
||||||
buf[x] = 0; // BUG
|
break;
|
||||||
|
}
|
||||||
|
buf[x] = 0; // WARNING
|
||||||
}
|
}
|
||||||
|
|
||||||
void bug_var_in_while(void) {
|
void var_in_while(void) {
|
||||||
int x = 0;
|
int x = 0;
|
||||||
while (x<__LINE__) {
|
while (x<100) {
|
||||||
buf[x] = 0; // BUG
|
buf[x] = 0; // BUG
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void var_after_while(void) {
|
||||||
|
int x = 0;
|
||||||
|
while (x<100)
|
||||||
|
x++;
|
||||||
|
buf[x] = 0; // BUG
|
||||||
|
}
|
||||||
|
|
||||||
// arg+var
|
// arg+var
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
|
|
||||||
void bug_arg_var_assign_in_if(int a) {
|
void arg_var_assign_in_if(int a) {
|
||||||
int x = 0;
|
int x = 0;
|
||||||
if (a==0)
|
if (a==0)
|
||||||
x = __LINE__;
|
x = 100;
|
||||||
buf[x] = 0; // BUG
|
buf[x] = 0; // WARNING
|
||||||
}
|
}
|
||||||
|
|
||||||
void bug_arg_var_second_if(int a) {
|
void arg_var_in_while_1(int a) {
|
||||||
int x = 0;
|
int x = 0;
|
||||||
if (a==0)
|
if (a == 100) {}
|
||||||
x = __LINE__;
|
|
||||||
if (a+1==1)
|
|
||||||
buf[x] = 0; // BUG
|
|
||||||
}
|
|
||||||
|
|
||||||
void bug_arg_var_after_while(int a) {
|
|
||||||
int x = 0;
|
|
||||||
if (a == __LINE__) {}
|
|
||||||
while (x<a)
|
|
||||||
x++;
|
|
||||||
buf[x] = 0; // BUG
|
|
||||||
}
|
|
||||||
|
|
||||||
void bug_arg_var_in_while(int a) {
|
|
||||||
int x = 0;
|
|
||||||
if (a == __LINE__) {}
|
|
||||||
while (x<a) {
|
while (x<a) {
|
||||||
buf[x] = 0; // BUG
|
buf[x] = 0; // WARNING
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void arg_var_in_while_2(int a) {
|
||||||
|
int x = 0;
|
||||||
|
while (x<a) {
|
||||||
|
buf[x] = 0; // WARNING
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
if (a == 100) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
void arg_var_after_while(int a) {
|
||||||
|
int x = 0;
|
||||||
|
if (a == 100) {}
|
||||||
|
while (x<a)
|
||||||
|
x++;
|
||||||
|
buf[x] = 0; // WARNING
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
int TestData[100];
|
int TestData[100];
|
||||||
|
|
||||||
|
|
||||||
void test_function_par(int par) {
|
void test_function_par1(int par) {
|
||||||
TestData[par] = 0;
|
TestData[par] = 0;
|
||||||
}
|
}
|
||||||
void test_function_par2(int x, int y) {
|
void test_function_par2(int x, int y) {
|
||||||
|
|
|
@ -5,6 +5,6 @@ int null_pointer() { int *p = 0; return *p; }
|
||||||
int *pointer_arithmetic() { static int buf[10]; return buf + 100; }
|
int *pointer_arithmetic() { static int buf[10]; return buf + 100; }
|
||||||
int shift_overrun(int x) { return x << 123; }
|
int shift_overrun(int x) { return x << 123; }
|
||||||
int shift_negative() { return -1 << 1; }
|
int shift_negative() { return -1 << 1; }
|
||||||
int signed_int_overrun() { int x = ~0; return x * 2; }
|
int signed_int_overrun() { int intmax = (~0U) >> 1; return intmax * 2; }
|
||||||
void string_literal() { *((char *)"hello") = 0; }
|
void string_literal() { *((char *)"hello") = 0; }
|
||||||
int uninit() { int x; return x + 2; }
|
int uninit() { int x; return x + 2; }
|
||||||
|
|
Loading…
Reference in New Issue