I have been using gcov to check code coverage. I now get a weird result, some functions are listed as not executed but the lines in the function is listed as executed.
lcov output:
13 0 : f<double>& operator*=(f<double>& lhs, const double& rhs)
14 : {
15 9 : // Some code...
16 0 : return lhs;
17 : }
gcov output:
#####: 13: f<double>& operator*=(f<double>& lhs, const double& rhs)
-: 14: {
9: 15: // Some code...
#####: 16: return lhs;
-: 17: }
How can the function be listed as NOT executed when the line(s) are? Is this possibly an artifact of GCC's optimization?
EDIT 1:
G++/gcov version: 4.9.2
lcov version: 1.11
EDIT 2:
Comping with -O2
yields the weird behavior. However, compiling with -O1
changes the ####
to 9