https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128346

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <[email protected]>:

https://gcc.gnu.org/g:b27f5e3c5d98d7c740c8f00aaeab9f1dea48c683

commit r17-5784-gb27f5e3c5d98d7c740c8f00aaeab9f1dea48c683
Author: Yongqiang Tian <[email protected]>
Date:   Sun Nov 1 09:09:05 2026 -0700

    [PATCH] tree-cfg: Ignore debug stmts when checking coverage nops [PR128346]

    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]>

Reply via email to