On 11/1/26 5:09 AM, Yongqiang Tian wrote:
gimple_can_merge_blocks_p checks the final statement of a block for the
compiler-inserted nop that marks a coverage-suppression boundary. A trailing
DEBUG_BEGIN_STMT hides that nop under -g, allows the blocks to be merged, and
changes the gcov CFG checksum even though the generated code is unchanged.
Use gsi_last_nondebug_bb so debug markers do not affect the merge decision.
Add a focused regression test.
The test case was found by a non-AI automated testing tool.
Assisted-by: OpenAI Codex 5.6 Sol.
Bootstrapped and regression tested on x86_64-pc-linux-gnu. The focused
test fails before the change and passes after it.
PR gcov-profile/128346
gcc/ChangeLog:
* tree-cfg.cc (gimple_can_merge_blocks_p): Ignore debug statements
when examining the end of a block.
gcc/testsuite/ChangeLog:
* gcc.misc-tests/gcov-45.c: New test.
Signed-off-by: Yongqiang Tian <[email protected]>
Thanks. Looks good to me. No issues in Sashiko. Pushed to the trunk.
Thanks again for all the fixes in this space!
jeff