gcov misses 'do' line in 'do {...} while(...)' loop?

Dan Krejsa dan.krejsa@gmail.com
Wed Mar 25 19:14:30 GMT 2020


Hi,

I'm using gcov on Arch linux

    $ gcov --version
    gcov (Arch Linux 9.2.1+20200130-2) 9.2.1 20200130
    Copyright (C) 2019 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.
    There is NO warranty; not even for MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.

via the google test / mock framework.

I have a C file containing a function with a 'do' loop in the following
format:

    do
        {
        /* various statements in here */
        }
    while (condition);

and in the corresponding .gcov file for the test, the line with 'do' is
shown
as un-executed, while the statements in the body of the loop are shown as
executed multiple times.  As a result, less than 100% coverage is reported
for this function by the test suite.

Is this kind of thing considered a bug in gcov?

- Dan



More information about the Gcc-help mailing list