2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / cet-label-2.c
blob8058117b03680f6464172a3b4c32294e6bf92273
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 } } } } */
7 __attribute__ ((noinline, noclone))
8 static int
9 func (int arg)
11 static void *array[] = { &&foo, &&bar };
13 goto *array[arg];
14 foo:
15 return arg*111;
16 bar:
17 return arg*777;
20 int
21 foo (int arg)
23 return func (arg);