Description of problem: If a *.c file only contains some global constant the gcno file produced by the --coverage option is not readable by lcov Version-Release number of selected component (if applicable): gcc-8.0.1-0.16.fc29.x86_64 How reproducible: [build@localhost tmp]$ cat t.c const int a = 5; [build@localhost tmp]$ gcc -Wall -Wextra -Werror -c ./t.c --coverage [build@localhost tmp]$ lcov --capture --initial --directory . Capturing coverage data from . Found gcov version: 8.0.1 Scanning . for .gcno files ... Found 2 graph files in . Processing t.gcno geninfo: ERROR: /tmp/t.gcno: reached unexpected end of file The same works as expected with gcc-7.3.1-2.fc27.x86_64 on Fedora 27: [sbose@p50 y]$ cat t.c const int a = 5; [sbose@p50 y]$ gcc -Wall -Wextra -Werror --coverage -c t.c [sbose@p50 y]$ lcov --capture --initial --directory . Capturing coverage data from . Found gcov version: 7.3.1 Scanning . for .gcno files ... Found 1 graph files in . Processing t.gcno TN: Finished .info-file creation
If it works with gcov, then it is a bug or missing support on the lcov side.
Presumably this is some new data format introduced in the files by latest toolchain. There's no sign of any recent fixes upstream lcov git, so probably no immediate easy solution to it.
Reported upstream at https://github.com/linux-test-project/lcov/issues/38
Jakub, I guess the change is caused by https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=254627 ... diff --git a/gcc/coverage.c b/gcc/coverage.c index f57897b8314..ea05d94f441 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -1269,6 +1269,9 @@ coverage_init (const char *filename) gcov_write_unsigned (GCOV_NOTE_MAGIC); gcov_write_unsigned (GCOV_VERSION); gcov_write_unsigned (bbg_file_stamp); + + /* Do not support has_unexecuted_blocks for Ada. */ + gcov_write_unsigned (strcmp (lang_hooks.name, "GNU Ada") != 0); } } ... With the example above on rawhide I get a gcno file with 16 bytes: [build@localhost tmp]$ od -c < t.gcno 0000000 o n c g R 0 8 A Q 256 235 373 001 \0 \0 \0 0000020 while on F27 there are only the first 12 bytes (magic, version and stamp) So lcov should expect another int32 in the header? Maybe gcc/gcov-io.h can be update to document this?
This is just one of the several changes in the format. I've filed http://gcc.gnu.org/PR84735 to let Martin Liska describe what he has changed, but he recommends not to use these files directly.
(In reply to Jakub Jelinek from comment #5) > This is just one of the several changes in the format. I've filed > http://gcc.gnu.org/PR84735 to let Martin Liska describe what he has changed, > but he recommends not to use these files directly. Thank you.
Daniel, https://github.com/linux-test-project/lcov/commit/a5dd9529f9232b8d901a4d6eb9ae54cae179e5b3 was just commited. Can you add it to the rawhide version of lcov?
lcov-1.13-3.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-7c8545beeb
*** Bug 1555038 has been marked as a duplicate of this bug. ***
lcov-1.13-3.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-7c8545beeb
lcov-1.13-4.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-504ce49143
lcov-1.13-4.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-504ce49143
lcov-1.13-4.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.
Hi, Is that fully addressed in Fedora? I noticed a large drop in gnutls' coverage report few months ago as reported by lcov (from 77% to 74.5, today it is being reported as low as 69% on f29). We could move to an earlier fedora (e.g., 27) to get a more accurate view, however that would mean reducing coverage as we lose new functionality like interop tests with openssl1.1.1, and software tpm emulator. https://gitlab.com/gnutls/gnutls/issues/550 https://gnutls.gitlab.io/coverage/master/