aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C
blob: 147c2b79f780b6fda2f22a04f03ba6ed924d4d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* PR c/94722 */
/* Test that stack protection is disabled via no_stack_protector attribute. */

/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -fstack-protector-explicit" } */
/* { dg-additional-options "-fno-PIE" { target ia32 } } */

/* { dg-do compile { target { ! hppa*-*-* } } } */

int __attribute__((no_stack_protector)) foo()
{
  int a;
  char b[34];
  return 0;
}

int __attribute__((stack_protect)) bar()
{
  int a;
  char b[34];
  return 0;
}

/* { dg-final { scan-assembler-times "stack_chk_fail" 1 { target { ! mips*-*-* } } } }*/
/* { dg-final { scan-assembler-times "stack_chk_fail" 2 { target { mips*-*-* } } } }*/