summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt34.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gnat.dg/opt34.adb')
-rw-r--r--gcc/testsuite/gnat.dg/opt34.adb29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/opt34.adb b/gcc/testsuite/gnat.dg/opt34.adb
new file mode 100644
index 00000000000..a5d0ab6319f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt34.adb
@@ -0,0 +1,29 @@
+-- { dg-do compile }
+-- { dg-options "-O -fdump-tree-esra" }
+
+with Opt34_Pkg; use Opt34_Pkg;
+
+procedure Opt34 is
+
+ function Local_Fun (Arg : T_Private) return T_Private is
+ Result : T_Private;
+ begin
+
+ case Get_Integer (Arg) is
+ when 1 =>
+ Result := Get_Private (100);
+ when 2 =>
+ Result := T_Private_Zero;
+ when others =>
+ null;
+ end case;
+
+ return Result;
+ end Local_Fun;
+
+begin
+ Assert (Get_Integer (Local_Fun (Get_Private (1))) = 100);
+end;
+
+-- { dg-final { scan-tree-dump "Created a replacement for result" "esra" } }
+-- { dg-final { cleanup-tree-dump "esra" } }