1  /* { dg-do run } */
       2  /* { dg-require-effective-target hwaddress_exec } */
       3  /* { dg-options "-fno-builtin-malloc -fno-builtin-free" } */
       4  /* { dg-shouldfail "asan" } */
       5  
       6  #ifdef __cplusplus
       7  extern "C" {
       8  #endif
       9  void *malloc (__SIZE_TYPE__);
      10  void free (void *);
      11  #ifdef __cplusplus
      12  }
      13  #endif
      14  
      15  int main() {
      16    char *x = (char*)malloc(10);
      17    free(x);
      18    return x[5];
      19  }
      20  
      21  /* { dg-output "HWAddressSanitizer: tag-mismatch on address 0x\[0-9a-f\]*.*" } */
      22  /* { dg-output "READ of size 1 at 0x\[0-9a-f\]* tags: \[\[:xdigit:\]\]\[\[:xdigit:\]\]/\[\[:xdigit:\]\]\[\[:xdigit:\]\] \\(ptr/mem\\) in thread T0.*" } */
      23  /* { dg-output "located 5 bytes inside of 10-byte region.*" } */
      24  /* { dg-output "freed by thread T0 here:.*" } */
      25  /* { dg-output "previously allocated here:" } */