&& ! may_trap_p (XEXP (eqnote, 0))))
remove_note (insn, note);
}
+ /* A tail call cannot trap either. The tailc/musttail pass could have
+ allowed a tail call if it could throw internally, but perform no
+ actual statements and then caused the exception to be thrown externally
+ in the hope that it is cleaned up later. If it is not, just
+ remove REG_EH_REGION note. While the call maybe can throw, the
+ current function's frame will not be there anymore when it does. */
+ if (CALL_P (insn)
+ && SIBLING_CALL_P (insn)
+ && (note = find_reg_note (insn, REG_EH_REGION, NULL)))
+ remove_note (insn, note);
/* Cleanup abnormal edges caused by exceptions or non-local gotos. */
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
--- /dev/null
+// PR middle-end/119613
+// { dg-do compile { target { musttail && { c || c++11 } } } }
+// { dg-options "-O0" }
+
+struct S { S () {} };
+char *foo (S);
+void bar (int);
+
+[[gnu::always_inline]] inline char *
+baz (S x)
+{
+ unsigned i;
+ &i;
+ bar (i);
+ [[gnu::musttail]] return foo (x);
+}
+
+char *
+qux (S)
+{
+ [[gnu::musttail]] return baz (S {});
+}