Skip to content

lcov incompatible with GCC 9.x coverage data #58

@berrange

Description

@berrange

Fedora 30 rawhide has pulled in the last GCC 9.0.0 version and this appears incompatible with lcov

$ echo "const int a = 5; int main(void) { return 1;}" > t.c
$ gcc -Wall -Wextra -Werror ./t.c --coverage
$ ./a.out 

Previously with GCC 8 compiled binaries this would work:

$ lcov -t "result" -o ex_test.info -c -d .
Capturing coverage data from .
Found gcov version: 8.2.1
Scanning . for .gcda files ...
Found 1 data files in .
Processing t.gcda
Finished .info-file creation
$ lcov -l ex_test.info
Reading tracefile ex_test.info
            |Lines       |Functions  |Branches    
Filename    |Rate     Num|Rate    Num|Rate     Num
==================================================
[/home/berrange/src/virt/libvirt-go/]
t.c         | 100%      1| 100%     1|    -      0
==================================================
      Total:| 100%      1| 100%     1|    -      0

With GCC 9 compiled binaries it fails

$ ./lcov/bin/lcov -t "result" -o ex_test.info -c -d .
Capturing coverage data from .
Found gcov version: 9.0.0
Scanning . for .gcda files ...
Found 1 data files in .
Processing t.gcda
geninfo: WARNING: /home/berrange/t.gcno: Overlong record at end of file!
geninfo: WARNING: gcov did not create any files for /home/berrange/t.gcda!
Finished .info-file creation

There are some GCC changes that affected coverage data format:

https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=261189
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=264462

The info above is all taken from a Fedora bug report https://bugzilla.redhat.com/show_bug.cgi?id=1668843

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions