about summary refs log tree commit diff
path: root/REORG.TODO/setjmp/jmpbug.c
diff options
context:
space:
mode:
Diffstat (limited to 'REORG.TODO/setjmp/jmpbug.c')
-rw-r--r--REORG.TODO/setjmp/jmpbug.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/REORG.TODO/setjmp/jmpbug.c b/REORG.TODO/setjmp/jmpbug.c
new file mode 100644
index 0000000000..8594c5a8a7
--- /dev/null
+++ b/REORG.TODO/setjmp/jmpbug.c
@@ -0,0 +1,41 @@
+/* setjmp vs alloca test case.  Exercised bug on sparc.  */
+
+#include <stdio.h>
+#include <setjmp.h>
+#include <alloca.h>
+
+static void
+sub5 (jmp_buf buf)
+{
+  longjmp (buf, 1);
+}
+
+static void
+test (int x)
+{
+  jmp_buf buf;
+  char *volatile foo;
+  int arr[100];
+
+  arr[77] = x;
+  if (setjmp (buf))
+    {
+      printf ("made it ok; %d\n", arr[77]);
+      return;
+    }
+
+  foo = (char *) alloca (128);
+  (void) foo;
+  sub5 (buf);
+}
+
+int
+main (void)
+{
+  int i;
+
+  for (i = 123; i < 345; ++i)
+    test (i);
+
+  return 0;
+}