2019-12-30 18:55:16 +01:00
|
|
|
|
2020-01-09 20:25:52 +01:00
|
|
|
// make USE_Z3=yes
|
2019-12-31 06:08:04 +01:00
|
|
|
// ./cppcheck --verify --inline-suppr --enable=information test/testsuites/danmar-verify/uninit.c
|
|
|
|
|
2020-01-14 10:28:05 +01:00
|
|
|
#include <string.h>
|
|
|
|
|
2019-12-31 06:08:04 +01:00
|
|
|
int array1() {
|
2019-12-30 18:55:16 +01:00
|
|
|
int a[10];
|
|
|
|
a[0] = 0;
|
2019-12-31 06:08:04 +01:00
|
|
|
// cppcheck-suppress verificationUninit
|
2019-12-30 18:55:16 +01:00
|
|
|
return a[2];
|
|
|
|
}
|
|
|
|
|
2019-12-31 06:08:04 +01:00
|
|
|
int array2() {
|
|
|
|
int a[10][10];
|
|
|
|
a[0][0] = 0;
|
|
|
|
// cppcheck-suppress verificationUninit
|
|
|
|
return a[2][3];
|
|
|
|
}
|
|
|
|
|
2020-01-14 10:28:05 +01:00
|
|
|
int local1() {
|
2019-12-31 14:57:42 +01:00
|
|
|
int x;
|
|
|
|
// cppcheck-suppress verificationUninit
|
2020-01-01 14:35:39 +01:00
|
|
|
// cppcheck-suppress uninitvar
|
2019-12-31 14:57:42 +01:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2019-12-31 06:08:04 +01:00
|
|
|
int pointer1(int *p) {
|
|
|
|
// cppcheck-suppress verificationUninit
|
|
|
|
return *p;
|
|
|
|
}
|
|
|
|
|
2020-01-14 10:28:05 +01:00
|
|
|
int pointer2(char *p) {
|
2020-01-01 14:35:39 +01:00
|
|
|
// cppcheck-suppress verificationUninitArg
|
2020-01-14 10:28:05 +01:00
|
|
|
return strlen(p);
|
2020-01-01 14:35:39 +01:00
|
|
|
}
|
|
|
|
|