aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/pr66908.c
blob: 5f731f0cbae2a4b77398a32595949be508a7ffcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* PR sanitizer/66908 */
/* { dg-do compile } */
/* { dg-options "-fsanitize=shift,bounds -O2 -Werror=maybe-uninitialized" } */
/* { dg-additional-options "-std=gnu90" { target c } } */

struct S { int a[22]; };
static int const e[22] = { };

void
foo (struct S const *s, unsigned int m, unsigned int *res)
{
  unsigned int i;
  for (i = 0; i < 22; ++i)
    res[i] = ((s->a[i] + e[i]) << m);
}