diff options
Diffstat (limited to 'setjmp/jmpbug.c')
-rw-r--r-- | setjmp/jmpbug.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/setjmp/jmpbug.c b/setjmp/jmpbug.c new file mode 100644 index 0000000..57a1de0 --- /dev/null +++ b/setjmp/jmpbug.c @@ -0,0 +1,32 @@ +/* setjmp vs alloca test case. Exercised bug on sparc. */ + +#include <stdio.h> +#include <setjmp.h> +#include <alloca.h> + +void +sub5 (jmp_buf buf) +{ + longjmp (buf, 1); +} + +int +main (void) +{ + jmp_buf buf; + char *foo; + int arr[100]; + + arr[77] = 76; + if (setjmp (buf)) + { + printf ("made it ok; %d\n", arr[77]); + exit (0); + } + + foo = (char *) alloca (128); + sub5 (buf); + + /* NOTREACHED */ + return 1; +} |