[compiler-rt] r224837 - Simplify allocator_returns_null.cc test
Timur Iskhodzhanov
timurrrr at google.com
Thu Dec 25 05:03:59 PST 2014
Author: timurrrr
Date: Thu Dec 25 07:03:58 2014
New Revision: 224837
URL: http://llvm.org/viewvc/llvm-project?rev=224837&view=rev
Log:
Simplify allocator_returns_null.cc test
Modified:
compiler-rt/trunk/test/asan/TestCases/allocator_returns_null.cc
Modified: compiler-rt/trunk/test/asan/TestCases/allocator_returns_null.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/allocator_returns_null.cc?rev=224837&r1=224836&r2=224837&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/allocator_returns_null.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/allocator_returns_null.cc Thu Dec 25 07:03:58 2014
@@ -24,14 +24,14 @@
int main(int argc, char **argv) {
volatile size_t size = std::numeric_limits<size_t>::max() - 10000;
assert(argc == 2);
- char *x = 0;
+ void *x = 0;
if (!strcmp(argv[1], "malloc")) {
fprintf(stderr, "malloc:\n");
- x = (char*)malloc(size);
+ x = malloc(size);
}
if (!strcmp(argv[1], "calloc")) {
fprintf(stderr, "calloc:\n");
- x = (char*)calloc(size / 4, 4);
+ x = calloc(size / 4, 4);
}
if (!strcmp(argv[1], "calloc-overflow")) {
@@ -39,18 +39,18 @@ int main(int argc, char **argv) {
volatile size_t kMaxSizeT = std::numeric_limits<size_t>::max();
size_t kArraySize = 4096;
volatile size_t kArraySize2 = kMaxSizeT / kArraySize + 10;
- x = (char*)calloc(kArraySize, kArraySize2);
+ x = calloc(kArraySize, kArraySize2);
}
if (!strcmp(argv[1], "realloc")) {
fprintf(stderr, "realloc:\n");
- x = (char*)realloc(0, size);
+ x = realloc(0, size);
}
if (!strcmp(argv[1], "realloc-after-malloc")) {
fprintf(stderr, "realloc-after-malloc:\n");
char *t = (char*)malloc(100);
*t = 42;
- x = (char*)realloc(t, size);
+ x = realloc(t, size);
assert(*t == 42);
free(t);
}
More information about the llvm-commits
mailing list