1 /* Check the attribute do not proparate through assignment. */
2 /* { dg-do compile } */
3 /* { dg-options "-O -fcf-protection" } */
4 /* { dg-final { scan-assembler-times "endbr32" 1 { target ia32 } } } */
5 /* { dg-final { scan-assembler-times "endbr64" 1 { target { ! ia32 } } } } */
6 /* { dg-final { scan-assembler-times "\tcall\[ \t]+" 1 { target { ! ia32 } || { ! *-*-darwin* } } } } */
7 /* { dg-final { scan-assembler-times "\tcall\[ \t]+" 2 { target { ia32 && *-*-darwin* } } } } */
8 /* { dg-final { scan-assembler-times "notrack call\[ \t]+" 1 } } */
9
10 int (*fptr) (int) __attribute__ ((nocf_check));
11 int (*fptr1) (int);
12
13 int
foo(int arg)14 foo (int arg)
15 {
16 int a;
17 a = (*fptr) (arg); /* non-checked call. */
18 arg += a;
19 fptr1 = fptr; /* { dg-warning "incompatible pointer type" } */
20 a = (*fptr1) (arg); /* checked call. */
21 return arg+a;
22 }
23