]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/59386 (ICE on valid code at -O2 and -O3 on x86_64-linux-gnu...
authorJakub Jelinek <jakub@redhat.com>
Wed, 11 Dec 2013 09:18:33 +0000 (10:18 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 11 Dec 2013 09:18:33 +0000 (10:18 +0100)
PR tree-optimization/59386
* tree-inline.c (remap_gimple_stmt): If not id->do_not_unshare,
unshare_expr (id->retval) before passing it to gimple_build_assign.

* gcc.c-torture/compile/pr59386.c: New test.

From-SVN: r205883

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr59386.c [new file with mode: 0644]
gcc/tree-inline.c

index c581a9771b48634fbe5326c187f3749a7824114d..22caa76f771d8e2ebb7ea84404a0766da71c6f52 100644 (file)
@@ -1,3 +1,9 @@
+2013-12-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/59386
+       * tree-inline.c (remap_gimple_stmt): If not id->do_not_unshare,
+       unshare_expr (id->retval) before passing it to gimple_build_assign.
+
 2013-12-11  Bin Cheng  <bin.cheng@arm.com>
 
        Reverted:
index 02da360515b423be1b2575fdee6a85b6e5648f0f..ebd99960b42ef2be6796ad390237bd30c54b0cb0 100644 (file)
@@ -1,3 +1,8 @@
+2013-12-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/59386
+       * gcc.c-torture/compile/pr59386.c: New test.
+
 2013-12-11  Bin Cheng  <bin.cheng@arm.com>
 
        Reverted:
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59386.c b/gcc/testsuite/gcc.c-torture/compile/pr59386.c
new file mode 100644 (file)
index 0000000..b014f70
--- /dev/null
@@ -0,0 +1,24 @@
+/* PR tree-optimization/59386 */
+
+struct S { int s; };
+struct T { int t; struct S u; } c;
+int b;
+
+struct S
+foo ()
+{
+  struct T d;
+  if (b)
+    while (c.t)
+      ;
+  else
+    return d.u;
+}
+
+struct S
+bar ()
+{
+  struct T a;
+  a.u = foo ();
+  return a.u;
+}
index ab8e40b804a6c930d7909fc7ea3fd12636b3dfe2..96a480593d46cbf203213f5a253eb9beb6447233 100644 (file)
@@ -1273,7 +1273,9 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
                  || ! SSA_NAME_VAR (retval)
                  || TREE_CODE (SSA_NAME_VAR (retval)) != RESULT_DECL)))
         {
-         copy = gimple_build_assign (id->retvar, retval);
+         copy = gimple_build_assign (id->do_not_unshare
+                                     ? id->retvar : unshare_expr (id->retvar),
+                                     retval);
          /* id->retvar is already substituted.  Skip it on later remapping.  */
          skip_first = true;
        }