gcc/testsuite/gcc.target/i386/cet-label.c
raw| 1 | /* Verify that -fcf-protection 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 | int func (int arg) |
| 8 | { |
| 9 | static void *array[] = { &&foo, &&bar }; |
| 10 | |
| 11 | goto *array[arg]; |
| 12 | foo: |
| 13 | return arg*111; |
| 14 | bar: |
| 15 | return arg*777; |
| 16 | } |