Debian Codegraph @

gcc/testsuite/c-c++-common/ubsan/pr112727.c

raw
1 /* PR sanitizer/112727 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fsanitize=shift-exponent,bounds-strict -Wuninitialized" } */
4
5 #ifndef __cplusplus
6 #define bool _Bool
7 #endif
8
9 struct S { bool s[8]; };
10
11 void
12 foo (const struct S *x)
13 {
14 unsigned n = 0;
15 for (unsigned j = 0; j < 8; j++)
16 n |= ((!x->s[j]) ? 1 : 0) << (16 + j);
17 }