This looks like it may result from using GCC optimization together with code coverage measurement. Since lcov builds on the output of GCC's gcov, the same restrictions apply. Please see section "Using gcov with GCC Optimization" in the gcov man for an explanation of why the above may happen and how to prevent it.