We currently record a kill for
*x_4(D) = always_throws ();
because we consider the store always executing since the appropriate
check for whether the stmt could throw is guarded by
!cfun->can_throw_non_call_exceptions.
PR ipa/111245
* ipa-modref.cc (modref_access_analysis::analyze_store): Do
not guard the check of whether the stmt could throw by
cfun->can_throw_non_call_exceptions.
* g++.dg/torture/pr111245.C: New testcase.
t->record_access_lto (t->m_summary_lto->stores, &r, a);
if (t->m_always_executed
&& a.useful_for_kill_p ()
- && (!cfun->can_throw_non_call_exceptions
- || !stmt_could_throw_p (cfun, stmt)))
+ && !stmt_could_throw_p (cfun, stmt))
{
if (dump_file)
fprintf (dump_file, " - Recording kill\n");
--- /dev/null
+/* { dg-do run } */
+
+struct Int {
+ int value;
+};
+
+__attribute__((noipa)) Int always_throws() { throw 123; }
+
+void foo(Int &x) {
+ try {
+ x = always_throws();
+ } catch (...) {
+ }
+}
+
+int main()
+{
+ Int x;
+ x.value = 5;
+ foo(x);
+ if (x.value != 5)
+ __builtin_abort ();
+}