summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/cet-notrack-5b.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/cet-notrack-5b.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/cet-notrack-5b.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/cet-notrack-5b.c b/gcc/testsuite/gcc.target/i386/cet-notrack-5b.c
new file mode 100644
index 00000000000..42d9d07b19d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cet-notrack-5b.c
@@ -0,0 +1,21 @@
+/* Check the attribute do not proparate through assignment. */
+/* { dg-do compile } */
+/* { dg-options "-O -fcf-protection -mcet" } */
+/* { dg-final { scan-assembler-times "endbr32" 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "endbr64" 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "\tcall\[ \t]+" 1 } } */
+/* { dg-final { scan-assembler-times "notrack call\[ \t]+" 1 } } */
+
+int (*fptr) (int) __attribute__ ((nocf_check));
+int (*fptr1) (int);
+
+int
+foo (int arg)
+{
+ int a;
+ a = (*fptr) (arg); /* non-checked call. */
+ arg += a;
+ fptr1 = fptr; /* { dg-warning "incompatible pointer type" } */
+ a = (*fptr1) (arg); /* checked call. */
+ return arg+a;
+}