re PR ipa/86389 (execute FAILs with -fipa-pta)
authorRichard Biener <rguenther@suse.de>
Tue, 3 Jul 2018 13:56:58 +0000 (13:56 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 3 Jul 2018 13:56:58 +0000 (13:56 +0000)
2018-07-03  Richard Biener  <rguenther@suse.de>

PR ipa/86389
* tree-ssa-structalias.c (find_func_clobbers): Properly
handle indirect calls.

* gcc.dg/torture/pr86389.c: New testcase.

From-SVN: r262341

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr86389.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index 338442904c91f94a554fa49fe450dc4ad5c703f0..c4ce163ded4ff981c0fd811fd8dafe4d0fe0d44e 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-03  Richard Biener  <rguenther@suse.de>
+
+       PR ipa/86389
+       * tree-ssa-structalias.c (find_func_clobbers): Properly
+       handle indirect calls.
+
 2018-07-03  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vect-patterns.c (vect_recog_rotate_pattern)
index 0ed116fd209c5e7b1d0b205d9c81bdb4072cda17..c1bfad8ccfce86c9a97e95d52b21ee24a193992c 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-03  Richard Biener  <rguenther@suse.de>
+
+       PR ipa/86389
+       * gcc.dg/torture/pr86389.c: New testcase.
+
 2018-07-03  Richard Sandiford  <richard.sandiford@arm.com>
 
        PR tree-optimization/85694
diff --git a/gcc/testsuite/gcc.dg/torture/pr86389.c b/gcc/testsuite/gcc.dg/torture/pr86389.c
new file mode 100644 (file)
index 0000000..cc29635
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fipa-pta" } */
+
+void callme (void (*callback) (void));
+
+int
+main (void)
+{
+  int ok = 0;
+  void callback (void) { ok = 1; }
+
+  callme (&callback);
+
+  if (!ok)
+    __builtin_abort ();
+  return 0;
+}
+
+__attribute__((noinline, noclone))
+void
+callme (void (*callback) (void))
+{
+  (*callback) ();
+}
index ac5d4bc93fe95a86917b37dbcaa637c1f8f215e4..fd24f84fb146e71b7a18a7548df648969c0f3361 100644 (file)
@@ -5353,6 +5353,7 @@ find_func_clobbers (struct function *fn, gimple *origt)
       /* For callees without function info (that's external functions),
         ESCAPED is clobbered and used.  */
       if (cfi->decl
+         && TREE_CODE (cfi->decl) == FUNCTION_DECL
          && !cfi->is_fn_info)
        {
          varinfo_t vi;