Debian Codegraph @

gcc/testsuite/gcc.target/arm/cmse/cmse-20.c

raw
1 /* This test is executed only if the execution engine supports CMSE instructions. */
2 /* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */
3
4 #include <arm_cmse.h>
5 #include <stdlib.h>
6 #include <stdio.h>
7
8 void __attribute__((cmse_nonsecure_entry))
9 secure_fun (int a, int *p)
10 {
11 void *b = cmse_check_address_range ((void *)p, a, 1);
12
13 if (b == NULL)
14 __builtin_abort ();
15 printf("%d", *((int *)b));
16 }
17
18 int
19 main (void)
20 {
21 int *ptr;
22 int size = 1;
23 ptr = (int *) calloc (1, sizeof(int *));
24 *ptr = 1315852292;
25 secure_fun (size, ptr);
26 free (ptr);
27 return 0;
28 }