Bug 31810 - gcov returns wrong results
Summary: gcov returns wrong results
Status: RESOLVED DUPLICATE of bug 12076
Alias: None
Product: gcc
Classification: Unclassified
Component: gcov-profile (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-04 02:32 UTC by Eric Christopher
Modified: 2009-03-30 16:01 UTC (History)
6 users (show)

See Also:
Host: i386-apple-darwin
Target: i386-apple-darwin
Build: i386-apple-darwin
Known to work:
Known to fail:
Last reconfirmed: 2007-05-04 02:32:30


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Christopher 2007-05-04 02:32:04 UTC
#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
Comment 1 Andrew Pinski 2007-05-04 02:34:13 UTC
And this is why people should not confirm their own bugs :).

*** This bug has been marked as a duplicate of 12076 ***
Comment 2 Eric Christopher 2007-05-04 02:38:17 UTC
Yeah, probably. Bah.