https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95957

            Bug ID: 95957
           Summary: All lines except for the last one in multiline
                    constructor reported as not run
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: loximann at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Source code:

#include <map>
#include <string>
#include <vector>

int main(int argc, char *argv[])
{
    static const std::vector<int> a{1,
        2,
        3,
        4};
    static const std::map<int, std::string> b{
        {1, "lol"}
    };
    b.at(1);
    return 0;
}

Command:
g++ --coverage coverage_test.cpp && ./a.out && gcov coverage_test.cpp

Gcov output:
        -:    0:Source:coverage_test.cpp
        -:    0:Graph:coverage_test.gcno
        -:    0:Data:coverage_test.gcda
        -:    0:Runs:1
        -:    1:#include <map>
        -:    2:#include <string>
        -:    3:#include <vector>
        -:    4:
        1:    5:int main(int argc, char *argv[])
        -:    6:{
        -:    7:    static const std::vector<int> a{1,
        -:    8:        2,
        -:    9:        3,
        2:   10:        4};
        -:   11:    static const std::map<int, std::string> b{
    #####:   12:        {1, "lol"}
        3:   13:    };
        1:   14:    b.at(1);
        1:   15:    return 0;
        -:   16:}

Line 12: should be marked as "-", same as 7, 8, 9 and 11 instead of "#####".

Reply via email to