aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/Regression/C/gcc-c-torture/execute/nestfunc-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/nestfunc-2.c')
-rw-r--r--SingleSource/Regression/C/gcc-c-torture/execute/nestfunc-2.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/nestfunc-2.c b/SingleSource/Regression/C/gcc-c-torture/execute/nestfunc-2.c
new file mode 100644
index 00000000..ee81f09e
--- /dev/null
+++ b/SingleSource/Regression/C/gcc-c-torture/execute/nestfunc-2.c
@@ -0,0 +1,49 @@
+/* { dg-require-effective-target trampolines } */
+
+extern int foo (int, int, int (*) (int, int, int, int, int, int, int));
+
+int z;
+
+int
+main (void)
+{
+ int sum = 0;
+ int i;
+
+ int nested (int a, int b, int c, int d, int e, int f, int g)
+ {
+ z = c + d + e + f + g;
+
+ if (a > 2 * b)
+ return a - b;
+ else
+ return b - a;
+ }
+
+ for (i = 0; i < 10; ++i)
+ {
+ int j;
+
+ for (j = 0; j < 10; ++j)
+ {
+ int k;
+
+ for (k = 0; k < 10; ++k)
+ sum += foo (i, j > k ? j - k : k - j, nested);
+ }
+ }
+
+ if (sum != 2300)
+ abort ();
+
+ if (z != 0x1b)
+ abort ();
+
+ exit (0);
+}
+
+int
+foo (int a, int b, int (* fp) (int, int, int, int, int, int, int))
+{
+ return fp (a, b, a, b, a, b, a);
+}