<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57481>57481</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Profiling data shows line not executed
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          pisanuw
      </td>
    </tr>
</table>

<pre>
    For the following program
```
#include <cassert>
#include <iostream>

int main() {
  assert(true);
  std::cout << "Done.";
}
```
Code coverage shows the `cout << "Done"` is executed 0 times when it is executed 1 times.
```
    1|       |#include <cassert>
    2|       |#include <iostream>
    3|       |
    4|      1|int main() {
    5|      1|  assert(true);
    6|      0|  std::cout << "Done.";
    7|      1|}
```

To profile the C++ program, I used the following script:
```
#!/bin/bash

clang++ -g -std=c++11 -fprofile-instr-generate -fcoverage-mapping main.cpp
./a.out
llvm-profdata merge default.profraw -output=merged.profraw
llvm-cov show ./a.out -instr-profile=merged.profraw 

# $ clang++ --version
# clang version 13.0.1 (Red Hat 13.0.1-2.module+el8.6.0+987+d36ea6a1)
# Target: x86_64-unknown-linux-gnu
# Thread model: posix
# InstalledDir: /usr/bin
```

clang-7 gives the correct output.


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVE2PmzAQ_TVwGYGwCQQOHLqbRu2tqnqvHJiAW8dGttls_33HQNlE-6EiC2y_8Xy9h0-m-9McjQU_IJyNUuYqdQ-jNb0Vlyg7RNmnqMzWsSx5LnWrpg4hyh9b4RxaH-Wf30Klcd4iOdrg-S21h4uQOuJVxGuI9g_LPsDqjVfeTkhYlG-Q812Uf6LRmskH5zQg4vxgNKb03Uyj_eHNxB8NJdWaJ7SiR3CDubq5bDJ4w2XwWGYgHeAztpPHDjLw8oIOrgNqkP4OYwuWvhkZ6GHR_hGWh2YfNzEY8Q_sX7U1WOX3B7b93bYfUni_9QDFneWHZACUm3E2z_6bnnBkfxfpPcKW9w8T5HiWCme2qBUPNDaJ8kf4CpMjCu4l7ForRx9SekfEEWcRP55CK44n4YbbmK0Sul8DJT0kc3GHdtlhDJLzmlIiNVGR9KhJVR4J-Cew5CLGMSQSup2247h4plYcRUotWpZKPV2S4KsTXsAFLSmzw7OYlE_DthVXSMh6pAP5Yca7f8CNBwo6Cxo297Bmtub56jDclkvdIKp2cFd2QnU4afSLyQzDug0sT7OU0bnqOzX_i_DrTsLTi-kmiskfUFVpmWY0q6s9vbu8RFEKFsS0uf0hKLHAFDxX5c9yl0z6tzZXnSipp-ek19ON7UC674ACoAonRuPk8wv8lWoWSmF3kDbA1I3J2ZXm9yU2F5bsoZdPuNwJrbEWWw9L69Nb4xgbVpasLuhhcdfkXZ3XIvbSK2y-ze0OtM-ELpcMrRG08dttEU9WNYP3owv65EcavfTDdEpbQ4o-Bk7XTyDwF2VCS-nchI4mxX5XsXhoKoaYnWusUOR5kSM_1dVJFN2uLErcFVWsxAmVa6KCGOUarzC7CD9jcYhlwzPOsypnbMdqxlIU2HWtqM9VkRfleR_tMiTxqjTkkRrbx7aZUzpNvSNQSefdC0i3hew14hyO_IvJD8Y2o3RCT9d4Dt3Mqf8FE-Pbpg">