gcc/testsuite/c-c++-common/hwasan/asan-pr63316.c
raw| 1 | /* PR sanitizer/63316 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-require-effective-target hwaddress_exec } */ |
| 4 | /* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */ |
| 5 | |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | extern void *malloc (__SIZE_TYPE__); |
| 10 | extern void free (void *); |
| 11 | #ifdef __cplusplus |
| 12 | } |
| 13 | #endif |
| 14 | |
| 15 | int |
| 16 | main () |
| 17 | { |
| 18 | int *p = (int *) malloc (sizeof (int)); |
| 19 | *p = 3; |
| 20 | asm volatile ("" : : "r" (p) : "memory"); |
| 21 | free (p); |
| 22 | return 0; |
| 23 | } |
| 24 |