summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2018-03-27 16:40:20 +0000
committerMatt Morehouse <mascasa@google.com>2018-03-27 16:40:20 +0000
commit22a1afd99fd0d0390f3db0d7c2f821592f90d62b (patch)
tree143f079b45faf08dbde50dfbfc915167bd4dcc0b
parent5d93fdfa898fb1fcfd574770362e5c79ba2deb2b (diff)
downloadbcm5719-llvm-22a1afd99fd0d0390f3db0d7c2f821592f90d62b.tar.gz
bcm5719-llvm-22a1afd99fd0d0390f3db0d7c2f821592f90d62b.zip
[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. llvm-svn: 328633
-rw-r--r--compiler-rt/test/fuzzer/LeakTest.cpp2
-rw-r--r--compiler-rt/test/fuzzer/ThreadedLeakTest.cpp2
-rw-r--r--compiler-rt/test/fuzzer/TraceMallocThreadedTest.cpp2
-rw-r--r--compiler-rt/test/fuzzer/fuzzer-leak.test6
-rw-r--r--compiler-rt/test/fuzzer/trace-malloc-threaded.test3
5 files changed, 6 insertions, 9 deletions
diff --git a/compiler-rt/test/fuzzer/LeakTest.cpp b/compiler-rt/test/fuzzer/LeakTest.cpp
index ea89e390105..f259e9d359f 100644
--- a/compiler-rt/test/fuzzer/LeakTest.cpp
+++ b/compiler-rt/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/compiler-rt/test/fuzzer/ThreadedLeakTest.cpp b/compiler-rt/test/fuzzer/ThreadedLeakTest.cpp
index 538d3b43480..59f3671fe9d 100644
--- a/compiler-rt/test/fuzzer/ThreadedLeakTest.cpp
+++ b/compiler-rt/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/compiler-rt/test/fuzzer/TraceMallocThreadedTest.cpp b/compiler-rt/test/fuzzer/TraceMallocThreadedTest.cpp
index 2b83d3597f3..0183d939af5 100644
--- a/compiler-rt/test/fuzzer/TraceMallocThreadedTest.cpp
+++ b/compiler-rt/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/compiler-rt/test/fuzzer/fuzzer-leak.test b/compiler-rt/test/fuzzer/fuzzer-leak.test
index 0b1a09f4dbf..c777797959e 100644
--- a/compiler-rt/test/fuzzer/fuzzer-leak.test
+++ b/compiler-rt/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/compiler-rt/test/fuzzer/trace-malloc-threaded.test b/compiler-rt/test/fuzzer/trace-malloc-threaded.test
index 4d96a6652ad..3e3679d5597 100644
--- a/compiler-rt/test/fuzzer/trace-malloc-threaded.test
+++ b/compiler-rt/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
OpenPOWER on IntegriCloud