1 /* { dg-do compile } */
2 /* { dg-options "-O0 -fcf-protection=none" } */
3 /* { dg-final { scan-assembler-not "endbr" } } */
4 /* { dg-final { scan-assembler-not "notrack call\[ \t]+" } } */
5 
6 int func (int a) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use '-fcf-protection' option to enable it" } */
7 int (*fptr) (int a) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use '-fcf-protection' option to enable it" } */
8 
foo(int arg)9 int foo (int arg)
10 {
11   int a, b;
12   a = func (arg);
13   b = (*fptr) (arg);
14   return a+b;
15 }
16 
17 int __attribute__ ((nocf_check))
func(int arg)18 func (int arg)
19 { /* { dg-warning "'nocf_check' attribute ignored. Use '-fcf-protection' option to enable it" } */
20   int (*fptrl) (int a) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use '-fcf-protection' option to enable it" } */
21   return arg*(*fptrl)(arg);
22 }
23