summary refs log tree commit diff
path: root/setjmp/jmpbug.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-03-12 10:01:41 +0000
committerRoland McGrath <roland@gnu.org>1996-03-12 10:01:41 +0000
commit6c46dada59a56f8748f6d956ef5d318155195840 (patch)
treee3811ee4b324730a87c0e77552ba8261ed117557 /setjmp/jmpbug.c
parent1177c8babf74c7335c5f3bf09c45961bebeed6c6 (diff)
downloadglibc-6c46dada59a56f8748f6d956ef5d318155195840.tar.gz
glibc-6c46dada59a56f8748f6d956ef5d318155195840.tar.xz
glibc-6c46dada59a56f8748f6d956ef5d318155195840.zip
Tue Mar 12 04:57:57 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> cvs/libc-960314 cvs/libc-960313 cvs/libc-960312
	* setjmp/Makefile (tests): Add jmpbug.
	* setjmp/jmpbug.c: New file.
Diffstat (limited to 'setjmp/jmpbug.c')
-rw-r--r--setjmp/jmpbug.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/setjmp/jmpbug.c b/setjmp/jmpbug.c
new file mode 100644
index 0000000000..57a1de0978
--- /dev/null
+++ b/setjmp/jmpbug.c
@@ -0,0 +1,32 @@
+/* setjmp vs alloca test case.  Exercised bug on sparc.  */
+
+#include <stdio.h>
+#include <setjmp.h>
+#include <alloca.h>
+
+void
+sub5 (jmp_buf buf)
+{
+  longjmp (buf, 1);
+}
+
+int
+main (void)
+{
+  jmp_buf buf;
+  char *foo;
+  int arr[100];
+
+  arr[77] = 76;
+  if (setjmp (buf))
+    {
+      printf ("made it ok; %d\n", arr[77]);
+      exit (0);
+    }
+
+  foo = (char *) alloca (128);
+  sub5 (buf);
+
+  /* NOTREACHED */
+  return 1;
+}