<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Coverage mapping: Malformed profile data"
   href="http://llvm.org/bugs/show_bug.cgi?id=22531">22531</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Coverage mapping: Malformed profile data
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>xeioexception@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Environment+Setup:
llvm revision: r228136
clang  Last Changed Rev: 228121
build: Debug+Asserts
OS: ubuntu 14.04


Steps to Reproduce: 

test1.c: NOT OK
==================
#include <stdio.h>

static int foo() { return 42; }
int main() {
 return 0;
}
==================
cp src/test1.c src/test.c; rm -fr default.profraw test.profdata ;
clang -c -o obj/test.o src/test.c -I -g -O0 -fprofile-instr-generate
-fcoverage-mapping; clang -o bin/test obj/test.o -I -g -O0
-fprofile-instr-generate -fcoverage-mapping; ./bin/test ;
llvm-profdata merge -o test.profdata default.profraw; llvm-cov show
./bin/test -instr-profile=test.profdata

error: Failed to load coverage: Malformed profile data



test2.c: OK
==================
#include <stdio.h>

static int foo() { return 42; }
int main() {
 return foo();
}
==================
cp src/test2.c src/test.c; rm -fr default.profraw test.profdata ;
clang -c -o obj/test.o src/test.c -I -g -O0 -fprofile-instr-generate
-fcoverage-mapping; clang -o bin/test obj/test.o -I -g -O0
-fprofile-instr-generate -fcoverage-mapping; ./bin/test ;
llvm-profdata merge -o test.profdata default.profraw; llvm-cov show
./bin/test -instr-profile=test.profdata

/home/xeioex/workspace/clang/experiments/llvm-cov/test/src/test.c:
       |    1|#include <stdio.h>
       |    2|
      1|    3|static int foo() { return 42; }
      1|    4|int main() {
      1|    5|  return foo();
      1|    6|}

test3.c: OK
==================
#include <stdio.h>

int foo() { return 42; }
int main() {
 return 0;
}
==================
cp src/test3.c src/test.c; rm -fr default.profraw test.profdata ;
clang -c -o obj/test.o src/test.c -I -g -O0 -fprofile-instr-generate
-fcoverage-mapping; clang -o bin/test obj/test.o -I -g -O0
-fprofile-instr-generate -fcoverage-mapping; ./bin/test ;
llvm-profdata merge -o test.profdata default.profraw; llvm-cov show
./bin/test -instr-profile=test.profdata

/home/xeioex/workspace/clang/experiments/llvm-cov/test/src/test.c:
       |    1|#include <stdio.h>
       |    2|
      0|    3|int foo() { return 42; }
      1|    4|int main() {
      1|    5|  return 0;
      1|    6|}


Preliminary investigations:
AFAICU, the issue somehow related to the unused non-void static functions.

The error raised because of llvm/lib/ProfileData/CoverageMappingReader.cpp
(SectionData::get) expects that function names are located inside
__llvm_prf_names section but it not true in case of test1.c, instead some of
the function names are located inside .rodata section.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>