Repository navigation
Use atomic GCC profile counters in coverage builds - #7461
Closed
JinmingHu (Jinming-Hu) wants to merge 1 commit into
Closed
JinmingHu (Jinming-Hu) wants to merge 1 commit into
JinmingHu (Jinming-Hu) wants to merge 1 commit into
Conversation
Enable -fprofile-update=atomic alongside GCC coverage instrumentation to keep counters consistent under concurrent SDK calls. Keep ordinary builds and gcovr error handling unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JinmingHu (Jinming-Hu)
requested review from
Larry Osterman (LarryOsterman),
Rick Winter (RickWinter) and
Jeff Fisher (xirzec)
as code owners
October 14, 2026 10:47
|
Azure Pipelines: Successfully started running 2 pipeline(s). 8 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The targeted flag is correctly limited by the existing GNU Debug coverage gate and preserves prior behavior.
0 open findings
What changed in this PR
Adds thread-safe GCC coverage-counter updates to reduce intermittent gcovr profile corruption.
Changes:
- Adds
-fprofile-update=atomicto GNU Debug coverage builds. - Documents why atomic counter updates are required.
| File | Description |
|---|---|
cmake-modules/AzureCodeCoverage.cmake |
Enables atomic GCC profile-counter updates for coverage instrumentation. |
🧠 Review effort: Balanced
Member
Author
|
/azp run cpp - storage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Anton Kolesnyk (antkmsft)
approved these changes
Oct 14, 2026
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
-fprofile-update=atomicto the existing GNU Debug coverage compiler flags incmake-modules/AzureCodeCoverage.cmake. This makes coverage-counter updates thread-safe when instrumented SDK code is called concurrently.This is a candidate fix for intermittent
gcovr NegativeHitsfailures, not a claim that their exact cause has already been established. GCC documents atomic updates as preventing profile corruption in multithreaded applications: https://gcc.gnu.org/onlinedocs/gcc-13.4.0/gcc/Instrumentation-Options.html#index-fprofile-updateEvidence
The same Ubuntu Storage LIVE coverage job failed while processing
storage_bearer_token_authentication_policy.cpp.gcdaon main and on #7448:Both logs report negative branch counts. In the PR retry, compilation and ctest succeeded; coverage generation failed.
Scope
Validation
ValidateLive Ubu2404_x64_with_unit_testcoverage workload are pending CI. Verify the effective compiler flags and successful coverage generation before considering this experiment successful.