OSDN Git Service

* tree-inline.c (copy_bb): Use GSI_CONTINUE_LINKING when inserting new
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 25 Sep 2010 21:34:45 +0000 (21:34 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 25 Sep 2010 21:34:45 +0000 (21:34 +0000)
statements because of the return slot optimization.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164622 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/return2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/return2.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/return2_pkg.ads [new file with mode: 0644]
gcc/tree-inline.c

index fb424bd..4abab85 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-25  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * tree-inline.c (copy_bb): Use GSI_CONTINUE_LINKING when inserting new
+       statements because of the return slot optimization.
+
 2010-09-25  Anatoly Sokolov  <aesok@post.ru>
 
        * config/avr/avr.h (CLASS_LIKELY_SPILLED_P): Remove.
index 6a65c79..d985372 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-25  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/return2.ad[sb]: New test.
+       * gnat.dg/return2_pkg.ads: New helper.
+
 2010-09-25  Daniel Kraft  <d@domob.eu>
 
        PR fortran/45776
diff --git a/gcc/testsuite/gnat.dg/return2.adb b/gcc/testsuite/gnat.dg/return2.adb
new file mode 100644 (file)
index 0000000..65b7bf0
--- /dev/null
@@ -0,0 +1,33 @@
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+with Return2_Pkg; use Return2_Pkg;
+
+package body Return2 is
+
+  function Value_Internal (Image : String) return Result_Internal_T is
+  begin
+    return (Member => False);
+  end;
+
+  type Result_T is array (1 .. 2) of Result_Internal_T;
+
+  function Value (Img : String) return T is
+    My_F : constant String := F;
+    Result : Result_T;
+    Value : T;
+  begin
+    for I in Result'Range loop
+      if G (My_F, I) /= "" then
+        Result (I) := Value_Internal (G (My_F, I));
+        if Result (I).Member then
+          Value (Result (I).Data) := True;
+        else
+          raise Program_Error;
+        end if;
+      end if;
+    end loop;
+    return Value;
+  end;
+
+end Return2;
diff --git a/gcc/testsuite/gnat.dg/return2.ads b/gcc/testsuite/gnat.dg/return2.ads
new file mode 100644 (file)
index 0000000..3e29910
--- /dev/null
@@ -0,0 +1,18 @@
+package Return2 is
+
+  type Kind_T is (One, Two);
+
+  type T is array (Kind_T) of Boolean;
+
+  type Result_Internal_T (Member : Boolean := False) is record
+    case Member is
+      when True =>
+        Data : Kind_T := Kind_T'First;
+      when False =>
+        null;
+    end case;
+  end record;
+
+  function Value (Img : String) return T;
+
+end Return2;
diff --git a/gcc/testsuite/gnat.dg/return2_pkg.ads b/gcc/testsuite/gnat.dg/return2_pkg.ads
new file mode 100644 (file)
index 0000000..f573865
--- /dev/null
@@ -0,0 +1,7 @@
+package Return2_Pkg is
+
+  function F return String;
+
+  function G (Line : String; Index : Positive) return String;
+
+end Return2_Pkg;
index 8a53d5e..b0627be 100644 (file)
@@ -1558,7 +1558,8 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
          tree new_rhs;
          new_rhs = force_gimple_operand_gsi (&seq_gsi,
                                              gimple_assign_rhs1 (stmt),
-                                             true, NULL, false, GSI_NEW_STMT);
+                                             true, NULL, false,
+                                             GSI_CONTINUE_LINKING);
          gimple_assign_set_rhs1 (stmt, new_rhs);
          id->regimplify = false;
        }