else if (gcall *call = dyn_cast <gcall *> (use_stmt))
{
tree callee = gimple_call_fndecl (call);
+
+ /* IPA PTA internally it treats calling a function as "writing" to
+ the argument space of all functions the function pointer points to
+ (PR101949). We can not drop EAF_NOCLOBBER only when ipa-pta
+ is on since that would allow propagation of this from -fno-ipa-pta
+ to -fipa-pta functions. */
+ if (gimple_call_fn (use_stmt) == name)
+ lattice[index].merge (~EAF_NOCLOBBER);
+
/* Return slot optimization would require bit of propagation;
give up for now. */
if (gimple_call_return_slot_opt_p (call)
--- /dev/null
+/* { dg-lto-do run } */
+/* { dg-lto-options { "-O2 -fipa-pta -flto -flto-partition=1to1" } } */
+
+extern int bar (int (*)(int *), int *);
+
+static int x;
+
+static int __attribute__ ((noinline)) foo (int *p)
+{
+ *p = 1;
+ x = 0;
+ return *p;
+}
+
+int main ()
+{
+ if (bar (foo, &x) != 0)
+ __builtin_abort ();
+ return 0;
+}