| 1 |
/* { dg-do run { target native } } */ |
| 2 |
/* { dg-options "-fstack-protector" } */ |
| 3 |
/* { dg-options "-fstack-protector -Wl,-multiply_defined,suppress" { target *-*-darwin* } } */ |
| 4 |
/* { dg-prune-output "-multiply_defined is obsolete" } */ |
| 5 |
/* { dg-require-effective-target fstack_protector } */ |
| 6 |
|
| 7 |
#include <stdlib.h> |
| 8 |
|
| 9 |
void |
| 10 |
__stack_chk_fail (void) |
| 11 |
{ |
| 12 |
exit (0); /* pass */ |
| 13 |
} |
| 14 |
|
| 15 |
void |
| 16 |
overflow() |
| 17 |
{ |
| 18 |
register int i = 0; |
| 19 |
char foo[30]; |
| 20 |
|
| 21 |
/* Overflow buffer. */ |
| 22 |
for (i = 0; i < 50; i++) |
| 23 |
foo[i] = 42; |
| 24 |
} |
| 25 |
|
| 26 |
int main (void) |
| 27 |
{ |
| 28 |
overflow (); |
| 29 |
return 1; /* fail */ |
| 30 |
} |