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