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