https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96919

Bhavana Kilambi <bhavana.kilambi at blackfigtech dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bhavana.kilambi@blackfigtec
                   |                            |h.com

--- Comment #8 from Bhavana Kilambi <bhavana.kilambi at blackfigtech dot com> 
---
This issue is reproducible in the trunk GCC version as well. 
Reverting the commit 6e49961ce47b8c554ff6081ef95a68a0616f0a93 helps in
mitigating the issue. Specifically, the problem seems to lie in the
add_line_counts() code changes in the gcov.c file as shown below : 

GCC8.2 gcc/gcov.c: 

...
...
2540           has_any_line = true;
2541
2542           if (!ix || ix + 1 == fn->blocks.size ())
2543             /* Entry or exit block.  */;
2544           else if (line != NULL)
2545             {
2546               line->blocks.push_back (block);
2547
2548               if (flag_branches)
2549                 {
2550                   arc_info *arc;
2551
2552                   for (arc = block->succ; arc; arc = arc->succ_next)
2553                     line->branches.push_back (arc);
...
...


Changing this part of the code to the one in the GCC7.5 version like this - 
GCC8.2 gcc/gcov.c modified : 
...
...
2541           if (!ix || ix + 1 == fn->blocks.size ())
2542             /* Entry or exit block.  */;
2543           else if (flag_branches)
2544             {
2545               arc_info *arc;
2546
2547               for (arc = block->succ; arc; arc = arc->succ_next)
2548                 {
2549                   line->branches.push_back (arc);
2550                   if (coverage && !arc->is_unconditional)
2551                     add_branch_counts (coverage, arc);
...
...


Helped in getting a full 100% coverage in GCC8.2. 
The executed line counts are being correctly updated for the source files until
line 2544 (in the original gcov.c version) after which the condition else if
(line != NULL) and the pushback of the block onto the line seems to be changing
the executed line counts. The modified version above (in accordance with the
code in gcc7.5) is able to get the desired coverage of 100% for the testcase
mentioned in this issue.

Reply via email to