Oh, and
INNERDECL is the actual object being referenced.
|| (!ptr_deref_may_alias_global_p (innerdecl)
is surely not what you want. That asks if *innerdecl is global memory.
I suppose you want is_global_var (innerdecl)? But with
&& (DECL_THREAD_LOCAL_P (innerdecl)
|| !TREE_STATIC (innerdecl))))
you can simply skip this test. Or what was it supposed to do?
The test was there because neither DECL_THREAD_LOCAL_P nor is_global_var
can handle MEM_REF's.
Would you prefer an explicit check for a *_DECL?
if (ALLOW_STORE_DATA_RACES
- || (!ptr_deref_may_alias_global_p (innerdecl)
+ || (DECL_P (innerdecl)
&& (DECL_THREAD_LOCAL_P (innerdecl)
|| !TREE_STATIC (innerdecl))))