]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/84739 (ICE in get_value_for_expr, at tree-ssa-ccp...
authorJakub Jelinek <jakub@redhat.com>
Mon, 25 Jun 2018 17:28:32 +0000 (19:28 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 25 Jun 2018 17:28:32 +0000 (19:28 +0200)
Backported from mainline
2018-03-08  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/84739
* tree-tailcall.c (find_tail_calls): Check call arguments against
DECL_ARGUMENTS (current_function_decl) rather than
DECL_ARGUMENTS (func) when checking for tail recursion.

* gcc.dg/pr84739.c: New test.

From-SVN: r262071

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr84739.c [new file with mode: 0644]
gcc/tree-tailcall.c

index 05359d44f500c8552ac3fb3769582af8a083dae6..8903a771e3f33959d9fd7dc3fcdbd3f5fc412675 100644 (file)
@@ -1,6 +1,13 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-03-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/84739
+       * tree-tailcall.c (find_tail_calls): Check call arguments against
+       DECL_ARGUMENTS (current_function_decl) rather than
+       DECL_ARGUMENTS (func) when checking for tail recursion.
+
        2018-03-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/84700
index 9da363f67f171df35f08aa88427c4f73fe5eccf2..48022ed15b6ac7b47992c029fd8e69db32d54923 100644 (file)
@@ -1,6 +1,11 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-03-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/84739
+       * gcc.dg/pr84739.c: New test.
+
        2018-03-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/84700
diff --git a/gcc/testsuite/gcc.dg/pr84739.c b/gcc/testsuite/gcc.dg/pr84739.c
new file mode 100644 (file)
index 0000000..9864f99
--- /dev/null
@@ -0,0 +1,26 @@
+/* PR tree-optimization/84739 */
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-options "-O2 -w" } */
+
+static void baz (void) __attribute__((weakref("bar")));
+
+int
+foo (int x, int y)
+{
+  if (x)
+    y = 0;
+  if (y)
+    goto lab;
+  y = 0;
+lab:
+  return y;
+}
+
+void
+bar (int x, int y)
+{
+  y = foo (x, y);
+  if (y != 0)
+    baz ();
+}
index 0436f0f04a643550dfa8facd61e45aa6f795e337..d7997688ec037eb8754d066d3e6abd0dc6b90086 100644 (file)
@@ -467,7 +467,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
     {
       tree arg;
 
-      for (param = DECL_ARGUMENTS (func), idx = 0;
+      for (param = DECL_ARGUMENTS (current_function_decl), idx = 0;
           param && idx < gimple_call_num_args (call);
           param = DECL_CHAIN (param), idx ++)
        {