forked from OSchip/llvm-project
parent
06cec4ceac
commit
6c0850afa4
|
@ -142,29 +142,24 @@ TEST(AddressSanitizer, SimpleDeathTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AddressSanitizer, VariousMallocsTest) {
|
TEST(AddressSanitizer, VariousMallocsTest) {
|
||||||
// fprintf(stderr, "malloc:\n");
|
|
||||||
int *a = (int*)malloc(100 * sizeof(int));
|
int *a = (int*)malloc(100 * sizeof(int));
|
||||||
a[50] = 0;
|
a[50] = 0;
|
||||||
free(a);
|
free(a);
|
||||||
|
|
||||||
// fprintf(stderr, "realloc:\n");
|
|
||||||
int *r = (int*)malloc(10);
|
int *r = (int*)malloc(10);
|
||||||
r = (int*)realloc(r, 2000 * sizeof(int));
|
r = (int*)realloc(r, 2000 * sizeof(int));
|
||||||
r[1000] = 0;
|
r[1000] = 0;
|
||||||
free(r);
|
free(r);
|
||||||
|
|
||||||
// fprintf(stderr, "operator new []\n");
|
|
||||||
int *b = new int[100];
|
int *b = new int[100];
|
||||||
b[50] = 0;
|
b[50] = 0;
|
||||||
delete [] b;
|
delete [] b;
|
||||||
|
|
||||||
// fprintf(stderr, "operator new\n");
|
|
||||||
int *c = new int;
|
int *c = new int;
|
||||||
*c = 0;
|
*c = 0;
|
||||||
delete c;
|
delete c;
|
||||||
|
|
||||||
#if !defined(__APPLE__) && !defined(ANDROID) && !defined(__ANDROID__)
|
#if !defined(__APPLE__) && !defined(ANDROID) && !defined(__ANDROID__)
|
||||||
// fprintf(stderr, "posix_memalign\n");
|
|
||||||
int *pm;
|
int *pm;
|
||||||
int pm_res = posix_memalign((void**)&pm, kPageSize, kPageSize);
|
int pm_res = posix_memalign((void**)&pm, kPageSize, kPageSize);
|
||||||
EXPECT_EQ(0, pm_res);
|
EXPECT_EQ(0, pm_res);
|
||||||
|
|
Loading…
Reference in New Issue