c++: robustify testcase [PR109752]
[official-gcc.git] / gcc / testsuite / g++.dg / no-stack-protector-attr-3.C
blob147c2b79f780b6fda2f22a04f03ba6ed924d4d5b
1 /* PR c/94722 */
2 /* Test that stack protection is disabled via no_stack_protector attribute. */
4 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
5 /* { dg-options "-O2 -fstack-protector-explicit" } */
6 /* { dg-additional-options "-fno-PIE" { target ia32 } } */
8 /* { dg-do compile { target { ! hppa*-*-* } } } */
10 int __attribute__((no_stack_protector)) foo()
12   int a;
13   char b[34];
14   return 0;
17 int __attribute__((stack_protect)) bar()
19   int a;
20   char b[34];
21   return 0;
24 /* { dg-final { scan-assembler-times "stack_chk_fail" 1 { target { ! mips*-*-* } } } }*/
25 /* { dg-final { scan-assembler-times "stack_chk_fail" 2 { target { mips*-*-* } } } }*/