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