aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gnat.dg/tail_call_p.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gnat.dg/tail_call_p.adb')
-rw-r--r--gcc-4.9/gcc/testsuite/gnat.dg/tail_call_p.adb35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gnat.dg/tail_call_p.adb b/gcc-4.9/gcc/testsuite/gnat.dg/tail_call_p.adb
new file mode 100644
index 000000000..56add5f6b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gnat.dg/tail_call_p.adb
@@ -0,0 +1,35 @@
+package body Tail_Call_P is
+
+ function Start_Side (Element : T) return Index is
+ begin
+ if Element = 1 then
+ raise Program_Error;
+ end if;
+ if Element = 0 then
+ return Second;
+ else
+ return First;
+ end if;
+ end;
+
+ function Segment (Element : T) return T is
+ begin
+ if Element /= 0 then
+ raise Program_Error;
+ end if;
+ return 1;
+ end;
+
+ procedure Really_Insert (Into : T; Element : T; Value : T) is
+ begin
+ if Into /= 0 then
+ raise Program_Error;
+ end if;
+ end;
+
+ procedure Insert (Into : A; Element : T; Value : T) is
+ begin
+ Really_Insert (Into (Start_Side (Element)), Segment (Element), Value);
+ end Insert;
+
+end Tail_Call_P;