1 /* { dg-do run { target native } } */ 2 /* { dg-options "-fstack-protector-explicit" } */ 3 /* { dg-require-effective-target fstack_protector } */ 4 5 #include <stdlib.h> 6 7 void __stack_chk_fail(void)8__stack_chk_fail (void) 9 { 10 exit (0); /* pass */ 11 } 12 main()13int __attribute__((stack_protect)) main () 14 { 15 int i; 16 char foo[255]; 17 18 // smash stack 19 for (i = 0; i <= 400; i++) 20 foo[i] = 42; 21 22 return 1; /* fail */ 23 } 24