1996-03-12 11:01:41 +01:00
|
|
|
/* setjmp vs alloca test case. Exercised bug on sparc. */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <alloca.h>
|
|
|
|
|
2000-12-27 21:26:07 +01:00
|
|
|
static void
|
1996-03-12 11:01:41 +01:00
|
|
|
sub5 (jmp_buf buf)
|
|
|
|
{
|
|
|
|
longjmp (buf, 1);
|
|
|
|
}
|
|
|
|
|
2000-12-27 21:26:07 +01:00
|
|
|
static void
|
1996-03-14 12:20:03 +01:00
|
|
|
test (int x)
|
1996-03-12 11:01:41 +01:00
|
|
|
{
|
|
|
|
jmp_buf buf;
|
2014-11-26 01:45:19 +01:00
|
|
|
char *volatile foo;
|
1996-03-12 11:01:41 +01:00
|
|
|
int arr[100];
|
|
|
|
|
1996-03-14 12:20:03 +01:00
|
|
|
arr[77] = x;
|
1996-03-12 11:01:41 +01:00
|
|
|
if (setjmp (buf))
|
|
|
|
{
|
|
|
|
printf ("made it ok; %d\n", arr[77]);
|
1996-03-14 12:20:03 +01:00
|
|
|
return;
|
1996-03-12 11:01:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
foo = (char *) alloca (128);
|
2014-11-26 01:45:19 +01:00
|
|
|
(void) foo;
|
1996-03-12 11:01:41 +01:00
|
|
|
sub5 (buf);
|
1996-03-14 12:20:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 123; i < 345; ++i)
|
|
|
|
test (i);
|
1996-03-12 11:01:41 +01:00
|
|
|
|
1996-03-14 12:20:03 +01:00
|
|
|
return 0;
|
1996-03-12 11:01:41 +01:00
|
|
|
}
|