Avoids ODR violations causing spurious ASAN warnings.
Details
- Reviewers
kcc kubamracek - Commits
- rGbebcbfb46dc7: [libFuzzer] Use custom allocators for STL containers in libFuzzer.
rGd50410bfb1d1: [libFuzzer] Use custom allocators for STL containers in libFuzzer
rCRT311866: [libFuzzer] Use custom allocators for STL containers in libFuzzer.
rCRT311830: [libFuzzer] Use custom allocators for STL containers in libFuzzer
rL311866: [libFuzzer] Use custom allocators for STL containers in libFuzzer.
rL311830: [libFuzzer] Use custom allocators for STL containers in libFuzzer
Diff Detail
- Repository
- rL LLVM
Event Timeline
The fuzzer:: qualifier is often spurious, but might be a helpful indication that some magic is going on.
Nice. Did this help?
lib/fuzzer/FuzzerDefs.h | ||
---|---|---|
22 ↗ | (On Diff #112483) | Why do you need this? |
test/fuzzer/VectorTest.cpp | ||
6 ↗ | (On Diff #112483) | Do some push_backs and pop_backs, just having a CTOR is not enough to trigger a warning. |
@kcc removed the test, I couldn't reproducibly get an error in this test. Let's just rely on fuzzers being able to run.
lib/fuzzer/FuzzerDefs.h | ||
---|---|---|
22 ↗ | (On Diff #112483) | I am asking only about #include <iostream> |
compiler-rt/trunk/lib/fuzzer/FuzzerMutate.h | ||
---|---|---|
145 | It would be nicer with fuzzer::vector -> Vector |
compiler-rt/trunk/lib/fuzzer/FuzzerMutate.h | ||
---|---|---|
145 | I am not sure, Vector to me implies another datastructure. In any case, I have already committed the revision. |
@vitalybuka @kcc It seems it breaks build with GCC: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/6318/steps/build/logs/stdio
Any ideas before rollback?
Maybe you need to do the same with string?
compiler-rt/trunk/lib/fuzzer/FuzzerMutate.h | ||
---|---|---|
145 | It is another data structure and we use camel style for them. |
Reverted. The error message seems to be about const/non-const, but I couldn't figure it out right now.
@vitalybuka @kcc Got it down to:
#include<memory> #include<vector> template<typename T> class my_allocator : public std::allocator<T> {}; template<typename T> using Vector = std::vector<T, my_allocator<T>>; int main() { Vector<Vector<uint8_t>> v; Vector<uint8_t> v2; v.push_back(v2); }
which fails under Linux with:
In file included from allocators.cc:3: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/vector:64: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_vector.h:319:9: error: no matching constructor for initialization of '_Vector_base<unsigned char, my_allocator<unsigned char> >' : _Base(__x.size(),
actually, even that was not sufficient: we seem to lose the ability to use initializer lists.
It would be nicer with fuzzer::vector -> Vector