This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gcov-profile/42660] New: buggy instrumentation - return statement never executed.


hi

i've noticed that in some cases, the test-coverage engine
doesn't record obvious source stmts (e.g. 'return s' from testcase).

$ cat t.cpp
#include <string>
#include <cstdio>

char foo( int i )
{
        return '0';
}

std::string bar( int i )
{
        std::string s;
        s+= foo( i );
        return s;
}

int main()
{
        std::puts( bar( 42 ).c_str() );
}

$ cat t.cpp.gcov
        -:    0:Source:t.cpp
        -:    0:Graph:t.gcno
        -:    0:Data:t.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:#include <string>
        -:    2:#include <cstdio>
        -:    3:
        1:    4:char foo( int i )
        -:    5:{
        1:    6:        return '0';
        -:    7:}
        -:    8:
        1:    9:std::string bar( int i )
        -:   10:{
        1:   11:        std::string s;
        1:   12:        s+= foo( i );
    #####:   13:        return s;
        -:   14:}
        -:   15:
        1:   16:int main()
        -:   17:{
        1:   18:        std::puts( bar( 42 ).c_str() );
        -:   19:}


-- 
           Summary: buggy instrumentation - return statement never executed.
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
 GCC build triplet: x86_64-gnu-linux
  GCC host triplet: x86_64-gnu-linux
GCC target triplet: x86_64-gnu-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]