]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/84739 (ICE in get_value_for_expr, at tree-ssa-ccp.c:649)
authorJakub Jelinek <jakub@redhat.com>
Thu, 8 Mar 2018 06:56:59 +0000 (07:56 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 8 Mar 2018 06:56:59 +0000 (07:56 +0100)
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: r258351

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

index 9c7dd744f0237c351c20cba6307130f6d4f18673..c96e895c3d8e3961efcf29609b997b6c731c8b38 100644 (file)
@@ -1,3 +1,10 @@
+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-07  Jakub Jelinek  <jakub@redhat.com>
 
        * doc/contrib.texi: Add entries for Martin Liska, David Malcolm,
index a6f89e15dcf1c7bfda3475458860b7bfb333c6b5..3f0ac96471a2756796d36958f25148437a3de8b0 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/84739
+       * gcc.dg/pr84739.c: New test.
+
 2018-03-07  Martin Sebor  <msebor@redhat.com>
 
        PR tree-optimization/83519
diff --git a/gcc/testsuite/gcc.dg/pr84739.c b/gcc/testsuite/gcc.dg/pr84739.c
new file mode 100644 (file)
index 0000000..6903425
--- /dev/null
@@ -0,0 +1,26 @@
+/* PR tree-optimization/84739 */
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-options "-O2" } */
+
+static void baz (void) __attribute__((weakref("bar")));        /* { dg-warning "alias between functions of incompatible types" } */
+
+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)     /* { dg-message "aliased declaration here" } */
+{
+  y = foo (x, y);
+  if (y != 0)
+    baz ();
+}
index 4e309cd9b412424918573fd0fe6403d48f03e928..9ebed9de524de57e473160e2d899284ee23ebf09 100644 (file)
@@ -481,7 +481,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 ++)
        {