diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c')
-rw-r--r-- | gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c new file mode 100644 index 00000000000..db0b0a44237 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/cet-notrack-icf-2.c @@ -0,0 +1,30 @@ +/* Verify nocf_check functions are not ICF optimized. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcf-protection -mcet" } */ +/* { dg-final { scan-assembler "endbr" } } */ +/* { dg-final { scan-assembler "fn3:" } } */ +/* { dg-final { scan-assembler "set\[ \t]+fn2,fn1" } } */ + +static __attribute__((noinline)) int +fn1 (int x) +{ + return x + 12; +} + +static __attribute__((noinline)) int +fn2 (int x) +{ + return x + 12; +} + +static __attribute__((noinline, nocf_check)) int +fn3 (int x) +{ + return x + 12; +} + +int +fn4 (int x) +{ + return fn1 (x) + fn2 (x) + fn3 (x); +} |