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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
             Blocks|                            |105231
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2022-06-28
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the call_insn satisfies can_nonlocal_goto () because we did

Trying 22 -> 23:
   22: r41:SI=`__clear_cache'
   23: call [r41:SI] argc:0x8
      REG_DEAD r41:SI
      REG_EH_REGION 0xffffffff80000000
Successfully matched this instruction:
(call (mem:QI (symbol_ref:SI ("__clear_cache")) [0  S1 A8])
    (const_int 8 [0x8]))
allowing combination of insns 22 and 23
original costs 3 + 0 = 0
replacement cost 0
deferring deletion of insn with uid = 22.
modifying insn i3    23: call [`__clear_cache'] argc:0x8
deferring rescan insn with uid = 23.

I have a fix.

diff --git a/gcc/combine.cc b/gcc/combine.cc
index a8305273e44..3d34e860cf9 100644
--- a/gcc/combine.cc
+++ b/gcc/combine.cc
@@ -14218,8 +14218,10 @@ distribute_notes (rtx notes, rtx_insn *from_insn,
rtx_insn *i3, rtx_insn *i2,
              gcc_assert (from_insn == i3);
            /* We are making sure there is a single effective REG_EH_REGION
               note and it's valid to put it on i3.  */
-           if (!insn_could_throw_p (from_insn))
-             /* Throw away stra notes on insns that can never throw.  */
+           if (!insn_could_throw_p (from_insn)
+               && (lp_nr != INT_MIN || !can_nonlocal_goto (from_insn)))
+             /* Throw away stray notes on insns that can never throw or
+                make a nonlocal goto.  */
              ;
            else
              {


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105231
[Bug 105231] [12 Regression] ICE: in rtl_verify_bb_insns, at cfgrtl.cc:2797
(flow control insn inside a basic block) with custom flags since
r12-4767-g81342e95827f77c0

Reply via email to