https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120987

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #30 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Ok, I think I have a patch which seems correct and such.
```
[apinski@xeond2 gcc]$ git diff
diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc
index fc00acecfce..d10a2752e05 100644
--- a/gcc/ipa-modref.cc
+++ b/gcc/ipa-modref.cc
@@ -5345,9 +5345,14 @@ ipa_merge_modref_summary_after_inlining (cgraph_edge
*edge)
   int flags = flags_from_decl_or_type (edge->callee->decl);
   /* Combine in outer flags.  */
   cgraph_node *n;
+  /* Only combine const/pure/novops related flags.
+     NoReturn and NoThrow cannot be combined.
+     An outer noreturn function might throw but an inner might be marked as
nothrow.  */
+  int flags_mask;
+  flags_mask = ECF_CONST | ECF_PURE | ECF_NOVOPS | ECF_LOOPING_CONST_OR_PURE;
   for (n = edge->caller; n->inlined_to; n = n->callers->caller)
-    flags |= flags_from_decl_or_type (n->decl);
-  flags |= flags_from_decl_or_type (n->decl);
+    flags |= flags_from_decl_or_type (n->decl) & flags_mask;
+  flags |= flags_from_decl_or_type (n->decl) & flags_mask;
   bool ignore_stores = ignore_stores_p (edge->caller->decl, flags);

   if (!callee_info && to_info)
```

Reply via email to