Skip to content

Inconsistent/wrong line coverage #185

@AndrzejKurek

Description

@AndrzejKurek

Hi there, I'm investigating line coverage for a new feature that I'm introducing to Mbed TLS, and I'm seeing inconsistencies when it comes to line coverage (branch information seems fine):
image
line 1857 is hit, even though nothing executed it.

Reproduction steps:
Starting from here:

make CFLAGS='--coverage -g3 -O0' LDFLAGS='--coverage' -C tests test_suite_x509parse
(cd tests && ./test_suite_x509parse)
make lcov #runs [scripts/lcov.sh](https://github.com/Mbed-TLS/mbedtls/blob/development/scripts/lcov.sh)
firefox Coverage/index.html

Check library/x509_crt.c coverage, line 1856 & 1857. The insides of the condition should not be hit.
I reduced the number of tests run to one that highlights the problem.
If you're not able to run this test or you'd like me to produce a possibly minimal test case - let me know, I'll try harder :)

Tool versions:
lcov 1.14 and 1.16 tested;
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

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