* opts.c (common_handle_option): Handle -fsanitize=alignment.
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / align-5.c
blobb94e167bb67b8b701711955c1ef5b29d6b02ce22
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. */
7 __attribute__((noinline, noclone)) int
8 foo (char *p)
10 p = (char *) __builtin_assume_aligned (p, __alignof__(int));
11 int *q = (int *) p;
12 return *q;
15 /* { dg-final { scan-assembler-not "__ubsan_handle" } } */