aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/cet-notrack-1a.c
blob: 427df5746d9b44ad89b51546afc4fe87c7301aea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-options "-O0 -fcf-protection=none" } */
/* { dg-final { scan-assembler-not "endbr" } } */
/* { dg-final { scan-assembler-not "notrack call\[ \t]+" } } */

int func (int a) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use '-fcf-protection' option to enable it" } */
int (*fptr) (int a) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use '-fcf-protection' option to enable it" } */

int foo (int arg)
{
  int a, b;
  a = func (arg);
  b = (*fptr) (arg);
  return a+b;
}

int __attribute__ ((nocf_check))
func (int arg)
{ /* { dg-warning "'nocf_check' attribute ignored. Use '-fcf-protection' option to enable it" } */
  int (*fptrl) (int a) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use '-fcf-protection' option to enable it" } */
  return arg*(*fptrl)(arg);
}