diff mbox

[v2] Get rid of stack trampolines for nested functions (4/4)

Message ID 3129144.GZRd3iTdUb@arcturus.home
State New
Headers show

Commit Message

Eric Botcazou Sept. 4, 2016, 8:15 p.m. UTC
This is the couple of testcases for the gnat.dg testsuite.  They test for the 
presence of the GNU-stack executable marker in the assembly file on Linux.


2016-07-04  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/trampoline3.adb: New test.
	* gnat.dg/trampoline4.adb: Likewise.
diff mbox

Patch

Index: testsuite/gnat.dg/trampoline3.adb
===================================================================
--- testsuite/gnat.dg/trampoline3.adb	(revision 0)
+++ testsuite/gnat.dg/trampoline3.adb	(working copy)
@@ -0,0 +1,22 @@ 
+-- { dg-do compile { target *-*-linux* } }
+-- { dg-options "-gnatws" }
+
+procedure Trampoline3 is
+
+  A : Integer;
+
+  type FuncPtr is access function (I : Integer) return Integer;
+
+  function F (I : Integer) return Integer is
+  begin
+    return A + I;
+  end F;
+
+  P : FuncPtr := F'Access;
+  I : Integer;
+
+begin
+  I := P(0);
+end;
+
+-- { dg-final { scan-assembler-not "GNU-stack.*x" } }
Index: testsuite/gnat.dg/trampoline4.adb
===================================================================
--- testsuite/gnat.dg/trampoline4.adb	(revision 0)
+++ testsuite/gnat.dg/trampoline4.adb	(working copy)
@@ -0,0 +1,23 @@ 
+-- { dg-do compile { target *-*-linux* } }
+-- { dg-options "-ftrampolines -gnatws" }
+-- { dg-skip-if "native descriptors" { hppa*-*-* ia64-*-* powerpc64-*-* } }
+
+procedure Trampoline4 is
+
+  A : Integer;
+
+  type FuncPtr is access function (I : Integer) return Integer;
+
+  function F (I : Integer) return Integer is
+  begin
+    return A + I;
+  end F;
+
+  P : FuncPtr := F'Access;
+  I : Integer;
+
+begin
+  I := P(0);
+end;
+
+-- { dg-final { scan-assembler "GNU-stack.*x" } }