]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR ipa/64896 (ICE in get_address_mode, at rtlanal.c:5442)
authorYvan Roux <yvan.roux@linaro.org>
Tue, 10 Mar 2015 19:20:30 +0000 (19:20 +0000)
committerYvan Roux <yroux@gcc.gnu.org>
Tue, 10 Mar 2015 19:20:30 +0000 (19:20 +0000)
gcc/
2015-03-10  Yvan Roux  <yvan.roux@linaro.org>

Backport from trunk r220489.
2015-02-06  Jakub Jelinek  <jakub@redhat.com>

PR ipa/64896
* cgraphunit.c (cgraph_node::expand_thunk): If
restype is not is_gimple_reg_type nor the thunk_fndecl
returns aggregate_value_p, set restmp to a temporary variable
instead of resdecl.

gcc/testsuite/
2015-03-10  Yvan Roux  <yvan.roux@linaro.org>

Backport from trunk r220489.
2015-02-06  Jakub Jelinek  <jakub@redhat.com>

PR ipa/64896
* g++.dg/ipa/pr64896.C: New test.

From-SVN: r221333

gcc/ChangeLog
gcc/cgraphunit.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr64896.C [new file with mode: 0644]

index 3d8ed5269e2c30d5715ef09d339d86a5532d33b9..9a152916076d6f0cbe598ae61975c98e63ef141e 100644 (file)
@@ -1,3 +1,14 @@
+2015-03-10  Yvan Roux  <yvan.roux@linaro.org>
+
+       Backport from trunk r220489.
+       2015-02-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR ipa/64896
+       * cgraphunit.c (cgraph_node::expand_thunk): If
+       restype is not is_gimple_reg_type nor the thunk_fndecl
+       returns aggregate_value_p, set restmp to a temporary variable
+       instead of resdecl.
+
 2015-03-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/65286
index 8f576076b6584a3d70139848a0e18c6314029c3d..130fc0debcb7a96e96ee611955e4bc5257218e6b 100644 (file)
@@ -1572,9 +1572,14 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks)
            restmp = gimple_fold_indirect_ref (resdecl);
          else if (!is_gimple_reg_type (restype))
            {
-             restmp = resdecl;
-             add_local_decl (cfun, restmp);
-             BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp;
+             if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl)))
+               {
+                 restmp = resdecl;
+                 add_local_decl (cfun, restmp);
+                 BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp;
+               }
+             else
+               restmp = create_tmp_var (restype, "retval");
            }
          else
            restmp = create_tmp_reg (restype, "retval");
index bf73c5a0ba16e1f941c4fba14de263d4aa85cde4..228da692829eb0bcea2e8391c92b943fc66498c7 100644 (file)
@@ -1,3 +1,11 @@
+2015-03-10  Yvan Roux  <yvan.roux@linaro.org>
+
+       Backport from trunk r220489.
+       2015-02-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR ipa/64896
+       * g++.dg/ipa/pr64896.C: New test
+
 2015-03-10  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/53988
diff --git a/gcc/testsuite/g++.dg/ipa/pr64896.C b/gcc/testsuite/g++.dg/ipa/pr64896.C
new file mode 100644 (file)
index 0000000..0a78220
--- /dev/null
@@ -0,0 +1,29 @@
+// PR ipa/64896
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A { int a, b; };
+struct B { A c; int d; };
+struct C { virtual B fn1 () const; };
+struct D { B fn2 () const; int fn3 () const; C *fn4 () const; };
+
+int
+D::fn3 () const
+{
+  fn4 ()->fn1 ();
+}
+
+B
+D::fn2 () const
+{
+  return B ();
+}
+
+class F : C
+{
+  B
+  fn1 () const
+  {
+    return B ();
+  }
+};