summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/asan/pr70712.c
blob: 74a6a75f20c928e786e8b0f80d9253a6b9757d71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* PR sanitizer/70712 */
/* { dg-do run } */

struct __attribute__((aligned (64))) S
{
  char s[4];
};

struct T
{
  char t[8];
  char u[480];

};

__attribute__((noinline, noclone)) void
foo (struct T *p, struct S *q)
{
  __builtin_memset (p->t, '\0', sizeof (p->t));
  __builtin_memset (p->u, '\0', sizeof (p->u));
  __builtin_memset (q->s, '\0', sizeof (q->s));
}

int
main ()
{
  struct S s;
  struct T t;
  foo (&t, &s);
  asm volatile ("" : : "r" (&t), "r" (&s) : "memory");
  return 0;
}