Debian Codegraph @

gcc/testsuite/c-c++-common/hwasan/hwasan-poison-optimisation.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target hwaddress_exec } */
3 /* { dg-shouldfail "hwasan" } */
4 /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
5 /* { dg-additional-options "-fdump-tree-asan1 -save-temps" } */
6
7 /* Here to check that the ASAN_POISON stuff works just fine.
8 This mechanism isn't very often used, but I should at least go through the
9 code-path once in my testfile. */
10 int
11 main ()
12 {
13 int *ptr = 0;
14
15 {
16 int a;
17 ptr = &a;
18 *ptr = 12345;
19 }
20
21 return *ptr;
22 }
23
24 /* { dg-final { scan-tree-dump-times "ASAN_POISON" 1 "asan1" } } */
25 /* { dg-final { scan-assembler-times "(?:bl|call)\\s*__hwasan_tag_mismatch4" 1 } } */
26 /* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */
27 /* { dg-output "READ of size 4 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/00 \\(ptr/mem\\) in thread T0.*" } */
28 /* { dg-output "Address 0x\[0-9a-f\]* is located in stack of thread T0.*" } */
29 /* { dg-output "SUMMARY: HWAddressSanitizer: tag-mismatch \[^\n\]*.*" } */