This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug gcov-profile/31810] New: gcov returns wrong results
- From: "echristo at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 May 2007 01:32:04 -0000
- Subject: [Bug gcov-profile/31810] New: gcov returns wrong results
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
#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