1  /* { dg-do run } */
       2  /* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
       3  /* { dg-shouldfail "asan" } */
       4  
       5  #include <sanitizer/asan_interface.h>
       6  
       7  char a[2] = "0";
       8  
       9  #ifdef __cplusplus
      10  extern "C"
      11  #endif
      12  __SIZE_TYPE__
      13  strlen (const char *p);
      14  
      15  int main () {
      16    char *p = &a[0];
      17    asm ("" : "+r"(p));
      18    __asan_poison_memory_region ((char *)&a[1], 1);
      19    return __builtin_strlen (a) + 1;
      20  }
      21  
      22  /* { dg-output "READ of size 2 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */
      23  /* { dg-output "    #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*strlen-overflow-1.c:19|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
      24  /* { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 0 bytes after global variable" } */