bootstrapped on x86_64-pc-linux-gnu.
Avoid cfg corruption when using sjlj exceptions where loops are present in the 
assign_params emitted code.

2024-08-06  Joern Rennecke  <joern.renne...@riscy-ip.com>

gcc/
        * except.cc (sjlj_emit_function_enter):
        Set fn_begin_outside_block again if encountering a jump instruction. 

diff --git a/gcc/except.cc b/gcc/except.cc
index b5886e97be9..5bb5edbd806 100644
--- a/gcc/except.cc
+++ b/gcc/except.cc
@@ -1228,6 +1228,10 @@ sjlj_emit_function_enter (rtx_code_label *dispatch_label)
        else if (NOTE_INSN_BASIC_BLOCK_P (fn_begin))
          fn_begin_outside_block = false;
       }
+    /* assign_params can indirectly call emit_block_move_via_loop, e.g.
+       for g++.dg/torture/pr85627.C for 16-bit targets.  */
+    else if (JUMP_P (fn_begin))
+      fn_begin_outside_block = true;
 
 #ifdef DONT_USE_BUILTIN_SETJMP
   if (dispatch_label)

Reply via email to