https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120987
--- Comment #29 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #28)
> Or maybe the fix is ignore_stores_p below the loop only should look
> the original decl's flags ...
That is this patch:
```
[apinski@xeond2 gcc]$ git diff
diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc
index fc00acecfce..12f7de05877 100644
--- a/gcc/ipa-modref.cc
+++ b/gcc/ipa-modref.cc
@@ -5343,12 +5343,12 @@ ipa_merge_modref_summary_after_inlining (cgraph_edge
*edge)
class modref_summary_lto *callee_info_lto
= summaries_lto ? summaries_lto->get (edge->callee) : NULL;
int flags = flags_from_decl_or_type (edge->callee->decl);
+ bool ignore_stores = ignore_stores_p (edge->caller->decl, flags);
/* Combine in outer flags. */
cgraph_node *n;
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);
- bool ignore_stores = ignore_stores_p (edge->caller->decl, flags);
if (!callee_info && to_info)
{
```
The problem is ignore_nondeterminism_p does the same check as ignore_stores_p
and ignore_nondeterminism_p is called below with the combined flags.