2018-03-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / cet-label-2.c
blobc7f79819079b65a907ac311bd80e0802c8f7fdf5
1 /* Verify that CET works. */
2 /* { dg-do compile } */
3 /* { dg-options "-O -fcf-protection -mcet" } */
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);