| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-fdump-tree-asan" } */ |
| 3 |
/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ |
| 4 |
/* Only skip the -flto tests without the -flto-partition=none. |
| 5 |
With -flto-partition=none we still get a asan1 dump file, without that |
| 6 |
parameter we only get the lto dump files (which means scan-tree-dump-times |
| 7 |
doesn't work. */ |
| 8 |
/* { dg-skip-if "" { *-*-* } { "-flto" } { "-flto-partition=none" } } */ |
| 9 |
|
| 10 |
typedef __SIZE_TYPE__ size_t; |
| 11 |
/* HWASAN used to instrument calls to memset, memcpy, and memmove. It no |
| 12 |
longer does this. Many other string and memory builtins are intercepted by |
| 13 |
the runtime (and hence the codegen need not do anything). */ |
| 14 |
void * __attribute__((noinline)) |
| 15 |
memset_builtin (void *dest, int value, size_t len) |
| 16 |
{ |
| 17 |
return __builtin_memset (dest, value, len); |
| 18 |
} |
| 19 |
|
| 20 |
size_t __attribute__ ((noinline)) |
| 21 |
strlen_builtin (char *element) |
| 22 |
{ |
| 23 |
return __builtin_strlen (element); |
| 24 |
} |
| 25 |
|
| 26 |
/* First check here ensures there is no inline instrumentation generated for |
| 27 |
these builtins. Second checks that we end up calling memset (i.e. that it's |
| 28 |
not optimised into an inline operation, which would happen without the |
| 29 |
instrumentation). */ |
| 30 |
/* { dg-final { scan-tree-dump-not "HWASAN_CHECK" "asan1" } } */ |
| 31 |
/* { dg-final { scan-assembler-times "\tmemset\\M" 1 } } */ |