Fix ComputeStats crash when first repetition is skipped#2207
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
The issue was encountered on a project using the vcpkg "benchmark" port version 1.9.5. That works for now, but it would be great to get it fixed upstream and eventually published to the vcpkg registry so we can eliminate that overlay port. |
|
Please rebase now that #2199 has been merged. |
That was the initial fix for the crash I encountered, but further investigation led to fixing the issues in statistics.cc which avoided both the crash and produces correct results. In principle the change in benchmark_runner.cc could be reverted, but on the other hand it makes the code more robust since the pointer is always valid. |
LebedevRI
left a comment
There was a problem hiding this comment.
(Awaiting diff update)
Adds a test verifying that calling SkipWithError on the first repetition with --benchmark_repetitions > 1 does not crash ComputeStats. AI-Assisted-by: Gemini (Google DeepMind Antigravity)
Fixes a crash in ComputeStats() when the first repetition is skipped by picking the first non-skipped report as the baseline for iterations and statistics, and ensuring report.statistics is always initialized. AI-Assisted-by: Gemini (Google DeepMind Antigravity)
9e7a49d to
1dd0dcf
Compare
|
Well, it looks like #2199 may actually fixed this crash issue. |
|
@dforsten thank you! |
Fixes #2206
When --benchmark_repetitions > 1 and the first repetition is skipped (via SkipWithError / SkipWithMessage ), ComputeStats() crashes due to:
Fixed by:
Also adds a regression test reproducing the crash.
AI-Assisted-by: Gemini (Google DeepMind Antigravity)