diff options
author | Matt Morehouse <mascasa@google.com> | 2018-03-27 16:40:20 +0000 |
---|---|---|
committer | Matt Morehouse <mascasa@google.com> | 2018-03-27 16:40:20 +0000 |
commit | dd22916b45f7624acd28fe614544a8206bed7ddd (patch) | |
tree | c3f65f424337cf520eb2a401e6b2e075dd8beffe /test | |
parent | 9d924ab8a5ce9dfebbdb1d04c715a2a5bb80c8b6 (diff) |
[libFuzzer] Place volatile after pointer types.
For a few tests, volatile was placed before the '*' in pointer
declarations, resulting in it applying to the underlying data rather
than the pointer itself. Placing volatile after the '*' allows us to
switch those tests to -O2.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328633 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/fuzzer/LeakTest.cpp | 2 | ||||
-rw-r--r-- | test/fuzzer/ThreadedLeakTest.cpp | 2 | ||||
-rw-r--r-- | test/fuzzer/TraceMallocThreadedTest.cpp | 2 | ||||
-rw-r--r-- | test/fuzzer/fuzzer-leak.test | 6 | ||||
-rw-r--r-- | test/fuzzer/trace-malloc-threaded.test | 3 |
5 files changed, 6 insertions, 9 deletions
diff --git a/test/fuzzer/LeakTest.cpp b/test/fuzzer/LeakTest.cpp index ea89e3901..f259e9d35 100644 --- a/test/fuzzer/LeakTest.cpp +++ b/test/fuzzer/LeakTest.cpp @@ -5,7 +5,7 @@ #include <cstddef> #include <cstdint> -static volatile void *Sink; +static void * volatile Sink; extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { if (Size > 0 && *Data == 'H') { diff --git a/test/fuzzer/ThreadedLeakTest.cpp b/test/fuzzer/ThreadedLeakTest.cpp index 538d3b434..59f3671fe 100644 --- a/test/fuzzer/ThreadedLeakTest.cpp +++ b/test/fuzzer/ThreadedLeakTest.cpp @@ -6,7 +6,7 @@ #include <cstdint> #include <thread> -static volatile int *Sink; +static int * volatile Sink; extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { if (Size == 0) return 0; diff --git a/test/fuzzer/TraceMallocThreadedTest.cpp b/test/fuzzer/TraceMallocThreadedTest.cpp index 2b83d3597..0183d939a 100644 --- a/test/fuzzer/TraceMallocThreadedTest.cpp +++ b/test/fuzzer/TraceMallocThreadedTest.cpp @@ -12,7 +12,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { auto C = [&] { - volatile void *a = malloc(5639); + void * volatile a = malloc(5639); free((void *)a); }; std::thread T[] = {std::thread(C), std::thread(C), std::thread(C), diff --git a/test/fuzzer/fuzzer-leak.test b/test/fuzzer/fuzzer-leak.test index 0b1a09f4d..c77779795 100644 --- a/test/fuzzer/fuzzer-leak.test +++ b/test/fuzzer/fuzzer-leak.test @@ -1,9 +1,7 @@ REQUIRES: lsan -// Avoid optimizing since it causes these leaks to go away. -RUN: %cpp_compiler -O0 %S/LeakTest.cpp -o %t-LeakTest -RUN: %cpp_compiler -O0 %S/ThreadedLeakTest.cpp -o %t-ThreadedLeakTest - +RUN: %cpp_compiler %S/LeakTest.cpp -o %t-LeakTest +RUN: %cpp_compiler %S/ThreadedLeakTest.cpp -o %t-ThreadedLeakTest RUN: %cpp_compiler %S/LeakTimeoutTest.cpp -o %t-LeakTimeoutTest RUN: rm -rf %t-corpus && mkdir -p %t-corpus diff --git a/test/fuzzer/trace-malloc-threaded.test b/test/fuzzer/trace-malloc-threaded.test index 4d96a6652..3e3679d55 100644 --- a/test/fuzzer/trace-malloc-threaded.test +++ b/test/fuzzer/trace-malloc-threaded.test @@ -2,8 +2,7 @@ // printing a stack trace repeatedly UNSUPPORTED: darwin -// Avoid optimizing since it causes the malloc to go away. -RUN: %cpp_compiler -O0 %S/TraceMallocThreadedTest.cpp -o \ +RUN: %cpp_compiler %S/TraceMallocThreadedTest.cpp -o \ RUN: %t-TraceMallocThreadedTest RUN: %t-TraceMallocThreadedTest -trace_malloc=2 -runs=1 2>&1 | FileCheck %s |