aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@bitrange.com>2002-01-05 03:56:05 +0000
committerHans-Peter Nilsson <hp@gcc.gnu.org>2002-01-05 03:56:05 +0000
commitf21bf182c7c3a47e8350e7ce9145efc21d2cf617 (patch)
tree4a2d24d0e6e936d68d0f5763f966283a88e9e354
parent4deaa2f859cdd84e7350d3c4e467d05cb8f3fa12 (diff)
downloadgcc-f21bf182c7c3a47e8350e7ce9145efc21d2cf617.zip
gcc-f21bf182c7c3a47e8350e7ce9145efc21d2cf617.tar.gz
gcc-f21bf182c7c3a47e8350e7ce9145efc21d2cf617.tar.bz2
* gcc.c-torture/execute/nestfunc-4.c: New test.
From-SVN: r48556
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c37
2 files changed, 41 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 01e7111..2d35e8c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-01-05 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * gcc.c-torture/execute/nestfunc-4.c: New test.
+
2002-01-04 Loren J. Rittle <ljrittle@acm.org>
* g++.old-deja/g++.abi/aggregates.C: Corrected last patch: removed
diff --git a/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c b/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c
new file mode 100644
index 0000000..e028166
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c
@@ -0,0 +1,37 @@
+/* Origin: hp@bitrange.com
+ Test that return values come out right from a 1000-level call chain to
+ functions without parameters that each need at least one "long"
+ preserved. Exposed problems related to the MMIX port. */
+
+long level = 0;
+extern long foo (void);
+extern long bar (void);
+
+#ifdef STACK_SIZE
+#define DEPTH ((STACK_SIZE) / 512 + 1)
+#else
+#define DEPTH 500
+#endif
+
+int
+main (void)
+{
+ if (foo () == -42)
+ exit (0);
+
+ abort ();
+}
+
+long
+foo (void)
+{
+ long tmp = ++level;
+ return bar () + tmp;
+}
+
+long
+bar (void)
+{
+ long tmp = level;
+ return tmp > DEPTH - 1 ? -42 - tmp : foo () - tmp;
+}