1 /* { dg-do compile } */
2 /* { dg-options "-fcf-protection" } */
3
4 int foo (void) __attribute__ ((nocf_check));
5 void (*foo1) (void) __attribute__((nocf_check));
6 void (*foo2) (void);
7
8 int __attribute__ ((nocf_check))
9 foo (void) /* The function's address is not tracked. */
10 {
11 /* This call site is not tracked for
12 control-flow instrumentation. */
13 (*foo1)();
14
15 foo1 = foo2; /* { dg-warning "incompatible pointer type" "" { target c } } */
16 /* { dg-error "invalid conversion" "" { target c++ } .-1 } */
17 /* This call site is still not tracked for
18 control-flow instrumentation. */
19 (*foo1)();
20
21 /* This call site is tracked for
22 control-flow instrumentation. */
23 (*foo2)();
24
25 foo2 = foo1; /* { dg-warning "incompatible pointer type" "" { target c } } */
26 /* { dg-error "invalid conversion" "" { target c++ } .-1 } */
27 /* This call site is still tracked for
28 control-flow instrumentation. */
29 (*foo2)();
30
31 return 0;
32 }