-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[coverage] incorrect coverage when a do-while contains break or continue statements #139122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
justincady
added a commit
to justincady/llvm-project
that referenced
this issue
May 13, 2025
The current region mapping for do-while loops that contain statements such as break or continue results in inaccurate line coverage reports for the line following the loop. This change handles terminating statements the same way that other loop constructs do, correcting the region mapping for accurate reports. It also fixes a fragile test relying on exact line numbers. Fixes llvm#139122
I reduced this further; it does not require a macro. It's a problem with the handling of do-while loops:
I posted a PR to address this issue. |
justincady
added a commit
to justincady/llvm-project
that referenced
this issue
May 19, 2025
The current region mapping for do-while loops that contain statements such as break or continue results in inaccurate line coverage reports for the line following the loop. This change handles terminating statements the same way that other loop constructs do, correcting the region mapping for accurate reports. It also fixes a fragile test relying on exact line numbers. Fixes llvm#139122
justincady
added a commit
that referenced
this issue
May 19, 2025
…#139777) The current region mapping for do-while loops that contain statements such as break or continue results in inaccurate line coverage reports for the line following the loop. This change handles terminating statements the same way that other loop constructs do, correcting the region mapping for accurate reports. It also fixes a fragile test relying on exact line numbers. Fixes #139122
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code coverage reporting is incorrect for macros that contain statements such as
break
andcontinue
:The coverage report incorrectly marks lines following
MY_MACRO()
as uncovered:These region terminating statements trigger the incorrect coverage:
break
continue
But these region terminating statements do not appear to trigger the incorrect coverage:
return
goto
__noreturn__
functionAlso, removing the
break
line from the example eliminates the incorrectly reported code coverage.The text was updated successfully, but these errors were encountered: