1  /* { dg-do compile } */
       2  /* { dg-options "-fno-sanitize=null -fsanitize=alignment -O2" } */
       3  /* Check that when optimizing if we know the alignment is right
       4     and we are not doing -fsanitize=null instrumentation we don't
       5     instrument the alignment check.  */
       6  
       7  __attribute__((noinline, noclone)) int
       8  foo (char *p)
       9  {
      10    p = (char *) __builtin_assume_aligned (p, __alignof__(int));
      11    int *q = (int *) p;
      12    return *q;
      13  }
      14  
      15  /* { dg-final { scan-assembler-not "__ubsan_handle" } } */