summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr71585-3.c
blob: 563291563120cf1a3b1d132b86b296aafffdd769 (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
/* Test that stack protection is done on chosen functions. */

/* { dg-do compile { target i?86-*-* x86_64-*-* rs6000-*-* s390x-*-* } } */
/* { dg-options "-O2 -fstack-protector-all" } */

/* This test checks the presence of __stack_chk_fail function in assembler.
 * Compiler generates _stack_chk_fail_local (wrapper) calls instead for PIC.
 */
/* { dg-require-effective-target nonpic } */


#pragma GCC push_options
#pragma GCC optimize ("-fno-stack-protector")

int foo()
{
  return 0;
}

#pragma GCC pop_options

int main() { foo (); }

/* { dg-final { scan-assembler-times "stack_chk_fail" 1 } } */