Debian Codegraph @

gcc/testsuite/gcc.target/i386/cet-label-2.c

raw
1 /* Verify that CET works. */
2 /* { dg-do compile } */
3 /* { dg-options "-O -fcf-protection" } */
4 /* { dg-final { scan-assembler-times "endbr32" 3 { target ia32 } } } */
5 /* { dg-final { scan-assembler-times "endbr64" 3 { target { ! ia32 } } } } */
6
7 __attribute__ ((noinline, noclone))
8 static int
9 func (int arg)
10 {
11 static void *array[] = { &&foo, &&bar };
12
13 goto *array[arg];
14 foo:
15 return arg*111;
16 bar:
17 return arg*777;
18 }
19
20 int
21 foo (int arg)
22 {
23 return func (arg);
24 }