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