1 /* Test that stack protection is done on chosen functions. */ 2 3 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ 4 /* { dg-options "-O2 -fstack-protector-explicit" } */ 5 A()6int A() 7 { 8 int A[23]; 9 char b[22]; 10 return 0; 11 } 12 B()13int __attribute__((stack_protect)) B() 14 { 15 int a; 16 int b; 17 return a+b; 18 } 19 c()20int __attribute__((stack_protect)) c() 21 { 22 int a; 23 char b[34]; 24 return 0; 25 } 26 27 28 /* { dg-final { scan-assembler-times "stack_chk_fail" 2 } } */ 29