[BZ #2831]
[glibc/pb-stable.git] / setjmp / jmpbug.c
blob125977b2f719dbeb5743c5133d144802d4b35cb7
1 /* setjmp vs alloca test case. Exercised bug on sparc. */
3 #include <stdio.h>
4 #include <setjmp.h>
5 #include <alloca.h>
7 static void
8 sub5 (jmp_buf buf)
10 longjmp (buf, 1);
13 static void
14 test (int x)
16 jmp_buf buf;
17 char *foo;
18 int arr[100];
20 arr[77] = x;
21 if (setjmp (buf))
23 printf ("made it ok; %d\n", arr[77]);
24 return;
27 foo = (char *) alloca (128);
28 sub5 (buf);
31 int
32 main (void)
34 int i;
36 for (i = 123; i < 345; ++i)
37 test (i);
39 return 0;