Debian Codegraph @

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

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