diff --git a/include/benchmark/benchmark_api.h b/include/benchmark/benchmark_api.h index 8deee87..80da8ea 100644 --- a/include/benchmark/benchmark_api.h +++ b/include/benchmark/benchmark_api.h @@ -216,7 +216,7 @@ Benchmark* RegisterBenchmarkInternal(Benchmark*); // Ensure that the standard streams are properly initialized in every TU. int InitializeStreams(); -static int stream_init_anchor = InitializeStreams(); +BENCHMARK_UNUSED static int stream_init_anchor = InitializeStreams(); } // end namespace internal diff --git a/src/benchmark.cc b/src/benchmark.cc index fca23e9..47936fe 100644 --- a/src/benchmark.cc +++ b/src/benchmark.cc @@ -553,7 +553,7 @@ void BenchmarkImp::Ranges(const std::vector>& ranges) { total *= arglists[i].size(); } - std::vector ctr(total, 0); + std::vector ctr(arglists.size(), 0); for (int i = 0; i < total; i++) { std::vector tmp; diff --git a/test/multiple_ranges_test.cc b/test/multiple_ranges_test.cc index b425acd..6365863 100644 --- a/test/multiple_ranges_test.cc +++ b/test/multiple_ranges_test.cc @@ -43,4 +43,10 @@ BENCHMARK_DEFINE_F(MultipleRangesFixture, Empty)(benchmark::State& state) { BENCHMARK_REGISTER_F(MultipleRangesFixture, Empty)->RangeMultiplier(2)->Ranges({{1, 2}, {3, 7}, {5, 15}})->Args({7, 6, 3}); +static void BM_MultipleRanges(benchmark::State& st) { + while (st.KeepRunning()) {} +} +BENCHMARK(BM_MultipleRanges)->Ranges({{5, 5}, {6, 6}}); + + BENCHMARK_MAIN()