summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-25 21:34:45 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-25 21:34:45 +0000
commit09cfc275e8ba2fc26faf6d2e2749f378b3515f54 (patch)
treef16c202bbfc408429913becbb1fb0f82f4b96a2e /gcc/testsuite/gnat.dg
parentf027352855d712f052e2368fdc41f26b5c306ef6 (diff)
downloadgcc-09cfc275e8ba2fc26faf6d2e2749f378b3515f54.tar.gz
* tree-inline.c (copy_bb): Use GSI_CONTINUE_LINKING when inserting new
statements because of the return slot optimization. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164622 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r--gcc/testsuite/gnat.dg/return2.adb33
-rw-r--r--gcc/testsuite/gnat.dg/return2.ads18
-rw-r--r--gcc/testsuite/gnat.dg/return2_pkg.ads7
3 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/return2.adb b/gcc/testsuite/gnat.dg/return2.adb
new file mode 100644
index 00000000000..65b7bf045ac
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/return2.adb
@@ -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
index 00000000000..3e29910d2c7
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/return2.ads
@@ -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
index 00000000000..f5738654a6d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/return2_pkg.ads
@@ -0,0 +1,7 @@
+package Return2_Pkg is
+
+ function F return String;
+
+ function G (Line : String; Index : Positive) return String;
+
+end Return2_Pkg;