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  /* Functions to observe that HWASAN instruments memory builtins in the expected
      12     manner.  */
      13  void * __attribute__((noinline))
      14  memset_builtin (void *dest, int value, size_t len)
      15  {
      16    return __builtin_memset (dest, value, len);
      17  }
      18  
      19  /* HWASAN avoids strlen because it doesn't know the size of the memory access
      20     until *after* the function call.  */
      21  size_t __attribute__ ((noinline))
      22  strlen_builtin (char *element)
      23  {
      24    return __builtin_strlen (element);
      25  }
      26  
      27  /* First test ensures that the HWASAN_CHECK was emitted before the
      28     memset.  Second test ensures there was only HWASAN_CHECK (which demonstrates
      29     that strlen was not instrumented).  */
      30  /* { dg-final { scan-tree-dump-times "HWASAN_CHECK.*memset" 1 "asan1" } } */
      31  /* { dg-final { scan-tree-dump-times "HWASAN_CHECK" 1 "asan1" } } */