[PATCH] D95918: [Coverage] Propogate counter to condition of conditional operator
Zequan Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 3 15:18:16 PST 2021
zequanwu added a comment.
In D95918#2540367 <https://reviews.llvm.org/D95918#2540367>, @vsk wrote:
> How was the issue spotted? If there was a crash or an incorrect coverage bug that's not triggered by one of the existing frontend tests, it'd be worth adding a regression test. If the problem can't be replicated without involving llvm-cov, this can be an integration test.
The issue was spotted by @pirama. But this doesn't completely solve the problem. When I was investigating the issue, I noticed condition expression of conditional operator was not given a counter. So, I sent this patch.
For the issue reported by @pirama, it is that llvm-cov shows following:
1| |#include <stdlib.h>
2| |
3| 1|int main() {
4| 1| return getenv(
5| 0| "TEST") ? 1
6| 1| : 0;
7| 1|}
Here are the debug dump.
Combined regions:
3:12 -> 7:2 (count=1)
4:10 -> 5:14 (count=1)
5:15 -> 5:17 (count=0)
5:17 -> 5:18 (count=0)
6:17 -> 6:18 (count=1)
Segment at 3:12 (count = 1), RegionEntry
Segment at 4:10 (count = 1), RegionEntry
Segment at 5:14 (count = 1)
Segment at 5:15 (count = 0), Gap
Segment at 5:17 (count = 0), RegionEntry
Segment at 5:18 (count = 1)
Segment at 6:17 (count = 1), RegionEntry
Segment at 6:18 (count = 1)
Segment at 7:2 (count = 0), Skipped
I am working on this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95918/new/
https://reviews.llvm.org/D95918
More information about the cfe-commits
mailing list