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