https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69838
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-02-19 CC| |jakub at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think the regression is since r199754 when LRA got enabled on s390x. Anyway, this is reproduceable even in C++ (if one looks at the RTL dumps, not as an executable testcase) with -O2 -fexceptions -fnon-call-exceptions: int foo () { try { *(int *)0 = 1; } catch (...) { return 1; } return 0; } The difference between reload and LRA is that reload reloads: (insn 7 2 30 2 (set (mem:SI (const_int 0 [0]) [2 MEM[(int *)0B]+0 S4 A64]) (const_int 1 [0x1])) a.c:6 67 {*movsi_zarch} (expr_list:REG_EH_REGION (const_int 1 [0x1]) (nil))) as: (insn 62 2 7 2 (set (reg:SI 1 %r1) (const_int 1 [0x1])) a.c:6 67 {*movsi_zarch} (nil)) (insn 7 62 30 2 (set (mem:SI (const_int 0 [0]) [2 MEM[(int *)0B]+0 S4 A64]) (reg:SI 1 %r1)) a.c:6 67 {*movsi_zarch} (expr_list:REG_EH_REGION (const_int 1 [0x1]) (nil))) i.e. the memory store is the original instruction and preserves the REG_EH_REGION note on it, while lra reloads it as: (insn 7 2 61 2 (set (reg:SI 1 %r1 [50]) (const_int 1 [0x1])) a.c:6 67 {*movsi_zarch} (nil)) (insn 61 7 3 2 (set (mem:SI (const_int 0 [0]) [2 MEM[(int *)0B]+0 S4 A64]) (reg:SI 1 %r1 [50])) a.c:6 67 {*movsi_zarch} (expr_list:REG_DEAD (reg:SI 1 %r1 [50]) (nil))) where the original insn doesn't contain the MEM anymore, and the new one does. Perhaps LRA should check if the insn it is reloading contains REG_EH_REGION note, and if yes, for all the reloading instructions it has added for the insn check if they might trap and if yes, copy (or move) the REG_EH_REGION note(s) to them.