| 1 |
/* PR target/83368 */ |
| 2 |
/* Testcase written by James Clarke <[email protected]> */ |
| 3 |
|
| 4 |
/* { dg-do run { target *-*-solaris2.* *-*-linux* *-*-*bsd* } } */ |
| 5 |
/* { dg-require-effective-target fpic } */ |
| 6 |
/* { dg-options "-fPIC" } */ |
| 7 |
|
| 8 |
#include <stdio.h> |
| 9 |
#include <setjmp.h> |
| 10 |
#include <string.h> |
| 11 |
#include <stdlib.h> |
| 12 |
|
| 13 |
jmp_buf jb; |
| 14 |
|
| 15 |
int foo = 99; |
| 16 |
int c = 0; |
| 17 |
|
| 18 |
void bar (void) |
| 19 |
{ |
| 20 |
c++; |
| 21 |
longjmp (jb, 1); |
| 22 |
} |
| 23 |
|
| 24 |
int main (void) |
| 25 |
{ |
| 26 |
setjmp (jb); |
| 27 |
|
| 28 |
char *p = __builtin_alloca (256); |
| 29 |
memset (p, 0, 256); |
| 30 |
sprintf (p, "%d\n", foo); |
| 31 |
|
| 32 |
if (c < 10) |
| 33 |
bar(); |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |