https://gcc.gnu.org/g:1681b203a0c9f37af82e0e0fcea7bfcc1dbfa00c

commit r16-7177-g1681b203a0c9f37af82e0e0fcea7bfcc1dbfa00c
Author: Jørgen Kvalsvik <[email protected]>
Date:   Tue Oct 14 10:52:54 2025 +0200

    gcov-dump: Print start-position for conditions
    
    The printed position should be the start of the record, as is the case
    with lines.
    
    Before:
    ex.gcno:  795:    01470000:  16:CONDITIONS 2 conditions
    ex.gcno:  811:                  block 2: 1
    ex.gcno:  819:                  block 5: 1
    ex.gcno:  819:    01000000:  50:FUNCTION ... `main' ...
    
    After:
    ex.gcno:  795:    01470000:  16:CONDITIONS 2 conditions
    ex.gcno:  803:                  block 2: 1
    ex.gcno:  811:                  block 5: 1
    ex.gcno:  819:    01000000:  50:FUNCTION ... `main' ...
    
    gcc/ChangeLog:
    
            * gcov-dump.cc (tag_conditions):  Read position before blocks,
            terms.

Diff:
---
 gcc/gcov-dump.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/gcov-dump.cc b/gcc/gcov-dump.cc
index 8fe72713b2f6..b3fc4279867c 100644
--- a/gcc/gcov-dump.cc
+++ b/gcc/gcov-dump.cc
@@ -406,11 +406,12 @@ tag_conditions (const char *filename, unsigned /* tag */, 
int length,
     {
       for (unsigned ix = 0; ix != n_conditions; ix++)
        {
+         const gcov_position_t position = gcov_position ();
          const unsigned blockno = gcov_read_unsigned ();
          const unsigned nterms = gcov_read_unsigned ();
 
          printf ("\n");
-         print_prefix (filename, depth, gcov_position ());
+         print_prefix (filename, depth, position);
          printf (VALUE_PADDING_PREFIX "block %u:", blockno);
          printf (" %u", nterms);
        }

Reply via email to