Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix violation under gcc of warning maybe-uninitialized in fingerprint…
… bench Summary: Fix the following violations of warning `maybe-uninitialized`: ``` [521/919] Building CXX object CMakeFiles/fingerprint_benchmark.dir/folly/test/FingerprintBenchmark.cpp.o In file included from folly/test/FingerprintBenchmark.cpp:20: folly/Fingerprint.h: In static member function ‘static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = folly::detail::TimeIterData; _Functor = folly::detail::BenchmarkingState<Clock>::addBenchmark(const char*, folly::StringPiece, Lambda&&) [with Lambda = main(int, char**)::<lambda(int)>&; Clock = std::chrono::_V2::system_clock]::<lambda(unsigned int)>; _ArgTypes = {unsigned int}]’: folly/Fingerprint.h:165:7: warning: array subscript 1 is outside array bounds of ‘uint64_t [1]’ {aka ‘long unsigned int [1]’} [-Warray-bounds] 165 | out[i] = fp_[i]; | ^~~ folly/test/FingerprintBenchmark.cpp:66:14: note: while referencing ‘out’ 66 | uint64_t out; | ^~~ In file included from folly/test/FingerprintBenchmark.cpp:20: folly/Fingerprint.h: In static member function ‘static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = folly::detail::TimeIterData; _Functor = folly::detail::BenchmarkingState<Clock>::addBenchmark(const char*, folly::StringPiece, Lambda&&) [with Lambda = main(int, char**)::<lambda(int)>&; Clock = std::chrono::_V2::system_clock]::<lambda(unsigned int)>; _ArgTypes = {unsigned int}]’: folly/Fingerprint.h:165:7: warning: array subscript 1 is outside array bounds of ‘uint64_t [1]’ {aka ‘long unsigned int [1]’} [-Warray-bounds] 165 | out[i] = fp_[i]; | ^~~ folly/test/FingerprintBenchmark.cpp:81:14: note: while referencing ‘out’ 81 | uint64_t out; | ^~~ ``` These are true positives, and when the benchmark is run with address sanitizer the bug is trapped as `stack-buffer-overflow`. Reviewed By: Orvid Differential Revision: D48497640 fbshipit-source-id: f2cb5d22c3edbdd174f3dcdf74b3670d0292365b
- Loading branch information