Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.target / arm / pac-8.c
blob3f37dcfa5c8af60ea722fbafa31f24711fe6b415
1 /* Testing return address signing. */
2 /* { dg-do run } */
3 /* { dg-require-effective-target mbranch_protection_ok } */
4 /* { dg-require-effective-target arm_pacbti_hw } */
5 /* { dg-options "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=pac-ret+leaf -mthumb -mfloat-abi=hard --save-temps -O0" } */
7 #include <stdarg.h>
8 #include <stdlib.h>
10 int acc (int n, ...)
12 int sum = 0;
13 va_list ptr;
15 va_start (ptr, n);
17 for (int i = 0; i < n; i++)
18 sum += va_arg (ptr, int);
19 va_end (ptr);
21 return sum;
24 int main()
26 if (acc (3, 1, 2, 3) != 6)
27 abort ();
29 return 0;
32 /* { dg-final { scan-assembler-times "pac\tip, lr, sp" 2 } } */
33 /* { dg-final { scan-assembler-times "aut\tip, lr, sp" 2 } } */
34 /* { dg-final { scan-assembler-not "\tbti" } } */