aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/pr112727.c
blob: cc8b3e2a565ef4ac7c8a57c9c2cbd2a29e16035f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* PR sanitizer/112727 */
/* { dg-do compile } */
/* { dg-options "-O2 -fsanitize=shift-exponent,bounds-strict -Wuninitialized" } */

#ifndef __cplusplus
#define bool _Bool
#endif

struct S { bool s[8]; };

void
foo (const struct S *x)
{
  unsigned n = 0;
  for (unsigned j = 0; j < 8; j++)
    n |= ((!x->s[j]) ? 1 : 0) << (16 + j);
}