Debian Codegraph @

gcc/testsuite/c-c++-common/hwasan/large-aligned-0.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target hwaddress_exec } */
3
4 /* Handling large aligned variables.
5 Large aligned variables take a different code-path through expand_stack_vars
6 in cfgexpand.c. This testcase is just to exercise that code-path.
7
8 The alternate code-path produces a second base-pointer through some
9 instructions emitted in the prologue.
10
11 Test cases are:
12 0) Valid access works without complaint.
13 1) Invalid access is caught. */
14 int __attribute__ ((noinline))
15 handle_large_alignment (int num)
16 {
17 int other_array[10];
18 int big_array[100] __attribute__ ((aligned (32)));
19 return big_array[num] + other_array[num];
20 }
21
22 #ifndef ARG
23 #define ARG 1
24 #endif
25
26 int global;
27
28 int __attribute__ ((noinline))
29 main ()
30 {
31 global += handle_large_alignment (ARG);
32 return 0;
33 }