2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr71585.c
blob444aaa1c35fb72688d9f65b4164fcbe71880e36a
1 /* Test that stack protection is done on chosen functions. */
3 /* { dg-do compile { target i?86-*-* x86_64-*-* rs6000-*-* s390x-*-* } } */
4 /* { dg-options "-O2 -fstack-protector-all" } */
6 /* This test checks the presence of __stack_chk_fail function in assembler.
7 * Compiler generates _stack_chk_fail_local (wrapper) calls instead for PIC.
8 */
9 /* { dg-require-effective-target nonpic } */
11 #pragma GCC push_options
13 #pragma GCC optimize ("-fno-stack-protector")
14 __attribute__((constructor)) void foo()
16 asm ("");
19 #pragma GCC pop_options
21 int main() { return 0; }
23 /* { dg-final { scan-assembler-times "stack_chk_fail" 1 } } */