[compiler-rt] r328633 - [libFuzzer] Place volatile after pointer types.

Matt Morehouse via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 27 09:40:20 PDT 2018


Author: morehouse
Date: Tue Mar 27 09:40:20 2018
New Revision: 328633

URL: http://llvm.org/viewvc/llvm-project?rev=328633&view=rev
Log:
[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.

Modified:
    compiler-rt/trunk/test/fuzzer/LeakTest.cpp
    compiler-rt/trunk/test/fuzzer/ThreadedLeakTest.cpp
    compiler-rt/trunk/test/fuzzer/TraceMallocThreadedTest.cpp
    compiler-rt/trunk/test/fuzzer/fuzzer-leak.test
    compiler-rt/trunk/test/fuzzer/trace-malloc-threaded.test

Modified: compiler-rt/trunk/test/fuzzer/LeakTest.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/LeakTest.cpp?rev=328633&r1=328632&r2=328633&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/LeakTest.cpp (original)
+++ compiler-rt/trunk/test/fuzzer/LeakTest.cpp Tue Mar 27 09:40:20 2018
@@ -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') {

Modified: compiler-rt/trunk/test/fuzzer/ThreadedLeakTest.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/ThreadedLeakTest.cpp?rev=328633&r1=328632&r2=328633&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/ThreadedLeakTest.cpp (original)
+++ compiler-rt/trunk/test/fuzzer/ThreadedLeakTest.cpp Tue Mar 27 09:40:20 2018
@@ -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;

Modified: compiler-rt/trunk/test/fuzzer/TraceMallocThreadedTest.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/TraceMallocThreadedTest.cpp?rev=328633&r1=328632&r2=328633&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/TraceMallocThreadedTest.cpp (original)
+++ compiler-rt/trunk/test/fuzzer/TraceMallocThreadedTest.cpp Tue Mar 27 09:40:20 2018
@@ -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),

Modified: compiler-rt/trunk/test/fuzzer/fuzzer-leak.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/fuzzer-leak.test?rev=328633&r1=328632&r2=328633&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/fuzzer-leak.test (original)
+++ compiler-rt/trunk/test/fuzzer/fuzzer-leak.test Tue Mar 27 09:40:20 2018
@@ -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

Modified: compiler-rt/trunk/test/fuzzer/trace-malloc-threaded.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/trace-malloc-threaded.test?rev=328633&r1=328632&r2=328633&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/trace-malloc-threaded.test (original)
+++ compiler-rt/trunk/test/fuzzer/trace-malloc-threaded.test Tue Mar 27 09:40:20 2018
@@ -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




More information about the llvm-commits mailing list