summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/attrib-4.c
blob: ba0f00cfb7f653cce38eefd970929b9b9a415c4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined" } */

/* Test that we don't instrument functions marked with
   no_sanitize_undefined attribute.  */

struct S { int a[16]; };

__attribute__((no_sanitize_undefined)) long long
foo (int *a, long long *b, struct S *c)
{
  return a[1] + *b + c->a[a[0]];
}

/* { dg-final { scan-assembler-not "__ubsan_handle" } } */