| /* Test that stack protection is done on chosen functions. */ |
| /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ |
| /* { dg-options "-O2 -fstack-protector-strong" } */ |
| /* 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 } */ |
| /* Frame address exposed to A::method via "this". */ |
| /* Possible destroying foo2's stack via &a. */ |
| /* Frame address exposed to global_func. */ |
| /* Frame addressed exposed through return slot. */ |
| /* Discourage passing this struct in registers. */ |
| int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; |
| return global_func ().a1; |
| return global_func ().a1; |
| return global_func ().a1; |
| return p->return_slot ().a1; |
| /* { dg-final { scan-assembler-times "stack_chk_fail" 7 } } */ |