blob: 8594c5a8a782b2182d0e8e39a58c4a2f08ebeec8 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* setjmp vs alloca test case. Exercised bug on sparc. */
2
3#include <stdio.h>
4#include <setjmp.h>
5#include <alloca.h>
6
7static void
8sub5 (jmp_buf buf)
9{
10 longjmp (buf, 1);
11}
12
13static void
14test (int x)
15{
16 jmp_buf buf;
17 char *volatile foo;
18 int arr[100];
19
20 arr[77] = x;
21 if (setjmp (buf))
22 {
23 printf ("made it ok; %d\n", arr[77]);
24 return;
25 }
26
27 foo = (char *) alloca (128);
28 (void) foo;
29 sub5 (buf);
30}
31
32int
33main (void)
34{
35 int i;
36
37 for (i = 123; i < 345; ++i)
38 test (i);
39
40 return 0;
41}