2 /* { dg-require-effective-target hwaddress_exec } */
3 /* { dg-shouldfail "hwasan" } */
4 /* Don't really need this option since there are no vararray/alloca objects in
5 the interesting function, however it never hurts to make doubly sure and
6 make it explicit that we're checking the alternate approach to deallocation.
8 /* { dg-additional-options "--param hwasan-instrument-allocas=0" } */
10 /* Handling large aligned variables.
11 Large aligned variables take a different code-path through expand_stack_vars
12 in cfgexpand.c. This testcase is just to exercise that code-path.
14 The alternate code-path produces a second base-pointer through some
15 instructions emitted in the prologue.
17 This eventually follows a different code path for untagging when not tagging
18 allocas. The untagging needs to work at the top of the frame, and this
19 should account for this different base when large aligned variables are
21 __attribute__ ((noinline
))
22 void * Ident (void * argument
)
30 void __attribute__ ((noinline
))
31 large_alignment_untagging (int num
, int *retval
, int **big
, int **other
)
33 int other_array
[100] ALIGNMENT
;
34 int big_array
[100] __attribute__ ((aligned (32)));
35 *retval
= big_array
[num
] + other_array
[num
];
36 *big
= (int*)Ident(big_array
);
37 *other
= (int*)Ident(other_array
);
46 int __attribute__ ((noinline
))
51 large_alignment_untagging (0, &retval
, &big
, &other
);
52 /* Want to test that both ends of both variables are untagged. */
70 /* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */
71 /* NOTE: This assumes the current tagging mechanism (one at a time from the
72 base and large aligned variables being handled first). */
73 /* { dg-output "READ of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/\[\[:xdigit:\]\]\[\[:xdigit:\]\] \\(ptr/mem\\) in thread T0.*" } */
74 /* { dg-output "Address 0x\[0-9a-f\]* is located in stack of thread T0.*" } */
75 /* { dg-output "SUMMARY: HWAddressSanitizer: tag-mismatch \[^\n\]*.*" } */