[llvm] [llvm-cov][CoverageMapping] Fix LineCoverageStats incorrectly using gap region count (PR #203740)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 13 20:30:46 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 175582 tests passed
* 3495 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.tools/llvm-cov/gap-region-line-coverage.test</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 20
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-cov show /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/Inputs/gap-region-quirk/gap-quirk.covmapping    -instr-profile /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/Inputs/gap-region-quirk/gap-quirk.profdata    -path-equivalence=/tmp,/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/Inputs/gap-region-quirk    2>&1 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -check-prefix=SHOW /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/gap-region-line-coverage.test
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-cov show /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/Inputs/gap-region-quirk/gap-quirk.covmapping -instr-profile /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/Inputs/gap-region-quirk/gap-quirk.profdata -path-equivalence=/tmp,/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/Inputs/gap-region-quirk
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -check-prefix=SHOW /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/gap-region-line-coverage.test
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/gap-region-line-coverage.test:26:10: error: SHOW: expected string not found in input
# | // SHOW: 15| 1| int result = 42;
# |          ^
# | <stdin>:1:1: note: scanning from here
# |  1| |// A scoped block with a never-taken early return followed by at least one
# | ^
# | <stdin>:15:2: note: possible intended match here
# |  15| 0| int result = 42;
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/tools/llvm-cov/gap-region-line-coverage.test
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1:  1| |// A scoped block with a never-taken early return followed by at least one 
# | check:26'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |             2:  2| |// statement is needed to produce the gap region pattern. Without the extra 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             3:  3| |// statement after the if-block, clang emits a region entry on the line after 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             4:  4| |// the closing "}" (MinRegionCount > 0) and the bug doesn't trigger. With the 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             5:  5| |// extra statement, the closing "}" produces a gap region that wraps forward, 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             6:  6| |// and the next line has only a non-entry segment (MinRegionCount == 0). 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# |            10:  10| 0| return false; 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~~~
# |            11:  11| 0| } 
# | check:26'0     ~~~~~~~~~~
# |            12:  12| 1| int fd = 1; 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~
# |            13:  13| 1| (void)fd; 
# | check:26'0     ~~~~~~~~~~~~~~~~~~
# |            14:  14| 1| } 
# | check:26'0     ~~~~~~~~~~
# |            15:  15| 0| int result = 42; 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:26'1      ?                        possible intended match
# |            16:  16| 1| (void)result; 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~~~
# |            17:  17| 1| return true; 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~~
# |            18:  18| 1|} 
# | check:26'0     ~~~~~~~~~
# |            19:  19| | 
# | check:26'0     ~~~~~~~
# |            20:  20| 1|int main() { 
# | check:26'0     ~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/203740


More information about the llvm-commits mailing list