[Bug gcov-profile/31810] New: gcov returns wrong results

echristo at apple dot com gcc-bugzilla@gcc.gnu.org
Fri May 4 01:32:00 GMT 2007


#include <string>

// this global string causes gcov to think there's executable lines
// beyond the end of the file, and that they have not been executed
std::string globalVar = "";

std::string
doSomething()
{
    // instantiating this string and calling a method on it causes the
    // 'return' line to be marked as having never been executed
    std::string localVar;
    localVar.size();
    return localVar;
}

int
main(int, char **)
{
    doSomething();
    return 0;
}

produces the wrong results:

a) it says that the return is never called
b) it executes past the end of the file


-- 
           Summary: gcov returns wrong results
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: echristo at apple dot com
 GCC build triplet: i386-apple-darwin
  GCC host triplet: i386-apple-darwin
GCC target triplet: i386-apple-darwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31810



More information about the Gcc-bugs mailing list