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

            Bug ID: 125002
           Summary: shrink-wrap.cc:can_get_prologue accepts jumps that
                    cannot be redirected
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amylaar at gcc dot gnu.org
  Target Milestone: ---

I observed this problem first in GCC 14 for an out-of-tree target.
RISC-V has in principle the same problem, but it is hidden for the testcase
by rtl-optimization/125001 .  See rtl-optimization/98289 for details.

The problematic code is still unchanged in GCC17 , and also the code in
rtl_redirect_edge_and_branch_force that cannot cope with redirecting
a register-indirect branch  We could either revert or
amend the 98289 patch to can_get_prologue, to leave EDGE_CROSSING edges
untouched in the HAS_LONG_UNCOND_BRANCH == false case, or, as I did in the
patch attachment of comment 7 of 98289, {make the branch redirection code cope
with
the most common case of label-indirect jumping, and add a test if that is
possible
as well}.

Reply via email to