]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR middle-end/52888 (Unable to inline function pointer call with inexact...
authorRichard Biener <rguenther@suse.de>
Fri, 1 Mar 2013 12:46:12 +0000 (12:46 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 1 Mar 2013 12:46:12 +0000 (12:46 +0000)
2013-03-01  Richard Biener  <rguenther@suse.de>

Backport from mainline
2012-04-10  Richard Guenther  <rguenther@suse.de>

PR middle-end/52888
* gimple-low.c (gimple_check_call_args): Properly account for
compatible aggregate types.

From-SVN: r196378

gcc/ChangeLog
gcc/gimple-low.c

index 438172f6cd8773e227e893433ec8252efbbe65b0..87026f0ddb5121cda1a0f7f7711d93ea4993e1d0 100644 (file)
@@ -1,3 +1,12 @@
+2013-03-01  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2012-04-10  Richard Guenther  <rguenther@suse.de>
+       PR middle-end/52888
+       * gimple-low.c (gimple_check_call_args): Properly account for
+       compatible aggregate types.
+
 2013-02-26  Nick Clifton  <nickc@redhat.com>
 
        PR target/56453
index c3d41282e8054f2e2f61a6eac7ed00a85289b609..293d4d7b82b148c958e1556f20622c3e8cf36aa1 100644 (file)
@@ -241,15 +241,17 @@ gimple_check_call_args (gimple stmt, tree fndecl)
           i < nargs;
           i++, p = DECL_CHAIN (p))
        {
+         tree arg;
          /* We cannot distinguish a varargs function from the case
             of excess parameters, still deferring the inlining decision
             to the callee is possible.  */
          if (!p)
            break;
+         arg = gimple_call_arg (stmt, i);
          if (p == error_mark_node
-             || gimple_call_arg (stmt, i) == error_mark_node
-             || !fold_convertible_p (DECL_ARG_TYPE (p),
-                                     gimple_call_arg (stmt, i)))
+             || arg == error_mark_node
+             || (!types_compatible_p (DECL_ARG_TYPE (p), TREE_TYPE (arg))
+                 && !fold_convertible_p (DECL_ARG_TYPE (p), arg)))
             return false;
        }
     }
@@ -257,15 +259,17 @@ gimple_check_call_args (gimple stmt, tree fndecl)
     {
       for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p))
        {
+         tree arg;
          /* If this is a varargs function defer inlining decision
             to callee.  */
          if (!p)
            break;
+         arg = gimple_call_arg (stmt, i);
          if (TREE_VALUE (p) == error_mark_node
-             || gimple_call_arg (stmt, i) == error_mark_node
+             || arg == error_mark_node
              || TREE_CODE (TREE_VALUE (p)) == VOID_TYPE
-             || !fold_convertible_p (TREE_VALUE (p),
-                                     gimple_call_arg (stmt, i)))
+             || (!types_compatible_p (TREE_VALUE (p), TREE_TYPE (arg))
+                 && !fold_convertible_p (TREE_VALUE (p), arg)))
             return false;
        }
     }