Debian Codegraph @

gcc/testsuite/gcc.target/arm/pac-8.c

raw
1 /* Testing return address signing. */
2 /* { dg-do run } */
3 /* { dg-require-effective-target arm_arch_v8_1m_main_pacbti_link } */
4 /* { dg-require-effective-target mbranch_protection_ok } */
5 /* { dg-require-effective-target arm_pacbti_hw } */
6 /* { dg-options "-mbranch-protection=pac-ret+leaf -mfloat-abi=hard --save-temps -O0" } */
7 /* { dg-add-options arm_arch_v8_1m_main_pacbti } */
8
9 #include <stdarg.h>
10 #include <stdlib.h>
11
12 int acc (int n, ...)
13 {
14 int sum = 0;
15 va_list ptr;
16
17 va_start (ptr, n);
18
19 for (int i = 0; i < n; i++)
20 sum += va_arg (ptr, int);
21 va_end (ptr);
22
23 return sum;
24 }
25
26 int main()
27 {
28 if (acc (3, 1, 2, 3) != 6)
29 abort ();
30
31 return 0;
32 }
33
34 /* { dg-final { scan-assembler-times "\tpac\tip, lr, sp" 2 } } */
35 /* { dg-final { scan-assembler-times "\taut\tip, lr, sp" 2 } } */
36 /* { dg-final { scan-assembler-not "\tbti" } } */