Debian Codegraph @

gcc/testsuite/g++.dg/no-stack-protector-attr-3.C

raw
1 /* PR c/94722 */
2 /* Test that stack protection is disabled via no_stack_protector attribute. */
3
4 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
5 /* { dg-options "-O2 -fstack-protector-explicit" } */
6 /* { dg-additional-options "-fno-PIE" { target ia32 } } */
7
8 /* { dg-do compile { target { ! hppa*-*-* } } } */
9
10 int __attribute__((no_stack_protector)) foo()
11 {
12 int a;
13 char b[34];
14 return 0;
15 }
16
17 int __attribute__((stack_protect)) bar()
18 {
19 int a;
20 char b[34];
21 return 0;
22 }
23
24 /* { dg-final { scan-assembler-times "stack_chk_fail" 1 { target { ! mips*-*-* } } } }*/
25 /* { dg-final { scan-assembler-times "stack_chk_fail" 2 { target { mips*-*-* } } } }*/