summaryrefslogtreecommitdiff
path: root/setjmp
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
parent1177c8babf74c7335c5f3bf09c45961bebeed6c6 (diff)
downloadglibc-6c46dada59a56f8748f6d956ef5d318155195840.tar.gz
Tue Mar 12 04:57:57 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>cvs/libc-960314cvs/libc-960313cvs/libc-960312
* setjmp/Makefile (tests): Add jmpbug. * setjmp/jmpbug.c: New file.
Diffstat (limited to 'setjmp')
-rw-r--r--setjmp/Makefile2
-rw-r--r--setjmp/jmpbug.c32
2 files changed, 33 insertions, 1 deletions
diff --git a/setjmp/Makefile b/setjmp/Makefile
index 4773b617e1..3d004852c8 100644
--- a/setjmp/Makefile
+++ b/setjmp/Makefile
@@ -26,7 +26,7 @@ headers := setjmp.h jmp_buf.h
routines := setjmp sigjmp bsd-setjmp bsd-_setjmp \
longjmp __longjmp jmp-unwind
-tests := tst-setjmp
+tests := tst-setjmp jmpbug
include ../Rules
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;
+}