<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/77873>77873</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Malformed MC/DC Coverage record on certain expressions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
evodius96
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chapuni
</td>
</tr>
</table>
<pre>
Reproducible case (https://godbolt.org/z/4vd8jczzz)
```
int foo(int a, int b, int c, int d, int e) {
return (a || (b && c) || d || e);
}
```
The emission crashes llvm-cov with generated profdata.
`assert(!TestVectors[Idx].empty() && "Test Vector doesn't exist.");`
```
Decision,File 0, 2:13 -> 2:36 = M:0, C:5
Branch,File 0, 2:13 -> 2:14 = (#0 - #5), #5 [1,0,4]
Branch,File 0, 2:19 -> 2:20 = #6, (#5 - #6) [4,5,3]
Branch,File 0, 2:24 -> 2:25 = #7, (#6 - #7) [5,0,3]
Branch,File 0, 2:30 -> 2:31 = (#3 - #4), #4 [3,0,0]
Branch,File 0, 2:35 -> 2:36 = (#1 - #2), #2 [2,0,0]
```
The chain is terminated at ID=3 and ID=2 is an orphan. `[3,0,2]` is expected.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMlM-OozgQxp-mciklgjJ_DxwS2Ehz6MtqtHcHF8EjgpFtMj399CsDmfTObI9aisKHXfXjc9ku6Zy-jswVpCcg4rtRenZlBkSQNjs5-97Yqu3lNI96dzHqR_U3T9aoudWXgbGVjhGo6L2fHIgj0BnofDXqYgZ_MPYKdH4DOid3VXxr397egEqIGoiOkEXbb3nVo8fOGKAiKAlUYxCXh2gfQj0EA5UI-WnNR0S07Gc7BjsSIa8hr4O-IFAGlAVE-RhXDxEoIDYI5M3_mlv_v_aMfNPOaTNia6Xr2eEw3G_71tzxu_Y9XnlkKz0rnKzplPTy8BMonWPrgQqg-Cs7_w-33lgH6emLeoW0OfBt8j-W-fJhGYhCKK6xqAy7ESj3yK_a-UPYpdX-f53-Yh-x4VYH20D1WQ-MUSgigTjGAvcg_lq0yBBEgy8gjst8DeKYboSTlWPb_zE9Tpb0ZQEiwj0CiTTYo3qRCOkpBqpDcgJpgw9zH7HLJ5uijS2yFVcsxP02UgZ2AlSnQLX4BJuSd-z0wc6f7Gxl5xs73Xx_hh3W_rOk8buaiJWZPGuSBLbY2NE79kfo9LfdWtHxiqYnmgKafkd_eLLbXuoRtUPP9qbH5RBLj18aEI1AOapVUgiRIxo79XI8YCA91xCaBmRRiOHXiVvP6rBTlVClKOWOqziP0kgkZZzt-kp1bSYSVrKTeaY6kXSxijIq8rLruuyidrqiiJIojilKkkJkh66krkgzkmnLRVcqSCK-ST0cwi0M3WannZu5yvMiF7tBXnhwW2cb-Tsuk1tns9Vycy_z1UESDdp596R47QeuXuTQGXtjhS810LmpsTZ3tvLKaLk1VmHoA2x9KBy_TpaX1uB2sx2qXxqi9v18ObTmBnQOn9ke-8mab9x6oPNizgGdF_P_BgAA___NQ3zK">