PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / cet-notrack-icf-1.c
blob7987d53d305fbbcd554054422361db3f490caef2
1 /* Verify nocf_check functions are not ICF optimized. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
4 /* { dg-final { scan-assembler-not "endbr" } } */
5 /* { dg-final { scan-assembler-not "fn3:" } } */
6 /* { dg-final { scan-assembler "set\[ \t]+fn2,fn1" } } */
7 /* { dg-final { scan-assembler "set\[ \t]+fn3,fn1" } } */
9 static __attribute__((noinline)) int
10 fn1 (int x)
12 return x + 12;
15 static __attribute__((noinline)) int
16 fn2 (int x)
18 return x + 12;
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;
27 int
28 fn4 (int x)
30 return fn1 (x) + fn2 (x) + fn3 (x);