diff mbox series

Avoid cfg corruption when using sjlj exceptions where loops are present in the assign_params emitted code.

Message ID 920bc655-813d-4dd6-8b0e-ceb6972ca68b@riscy-ip.com
State New
Headers show
Series Avoid cfg corruption when using sjlj exceptions where loops are present in the assign_params emitted code. | expand

Commit Message

Joern Wolfgang Rennecke Aug. 9, 2024, 7:14 a.m. UTC
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.rennecke@riscy-ip.com>

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

Comments

Jeff Law Aug. 10, 2024, 2:39 p.m. UTC | #1
On 8/9/24 1:14 AM, Joern Wolfgang Rennecke wrote:
> bootstrapped on x86_64-pc-linux-gnu.
> 
> anti-cfg-corrupt.txt
> 
> Avoid cfg corruption when using sjlj exceptions where loops are present in the assign_params emitted code.
> 
> 2024-08-06  Joern Rennecke<joern.rennecke@riscy-ip.com>
> 
> gcc/
> 	* except.cc (sjlj_emit_function_enter):
> 	Set fn_begin_outside_block again if encountering a jump instruction.
OK.

Jeff
diff mbox series

Patch

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)