Debian Codegraph @

gcc/testsuite/gcc.target/i386/cet-notrack-icf-1.c

raw
1 /* Verify nocf_check functions are not ICF optimized. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fcf-protection=none" } */
4 /* { dg-final { scan-assembler-not "endbr" } } */
5 /* { dg-final { scan-assembler-not "fn3:" } } */
6 /* { dg-final { scan-assembler "set\[ \t]+fn2,fn1" { target { ! *-*-darwin* } } } } */
7 /* { dg-final { scan-assembler "set\[ \t]+fn3,fn1" { target { ! *-*-darwin* } } } } */
8
9 static __attribute__((noinline)) int
10 fn1 (int x)
11 {
12 return x + 12;
13 }
14
15 static __attribute__((noinline)) int
16 fn2 (int x)
17 {
18 return x + 12;
19 }
20
21 static __attribute__((noinline, nocf_check)) int
22 fn3 (int x)
23 { /* { dg-warning "'nocf_check' attribute ignored. Use '-fcf-protection' option to enable it" } */
24 return x + 12;
25 }
26
27 int
28 fn4 (int x)
29 {
30 return fn1 (x) + fn2 (x) + fn3 (x);
31 }