aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ubsan/pr89284.c
blob: 965225c6702e63f56aa15b913ede0e29d0fcb7bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* PR middle-end/89284 */
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined -O0 -Wuninitialized" } */

struct A { _Bool a; int i; };

int
foo (void)
{
  struct A a;
  if (a.i)	/* { dg-warning "'a.i' is used uninitialized" } */
    return 1;
  return 0;
}

int
bar (void)
{
  struct A a;
  if (a.a)	/* { dg-warning "'a.a' is used uninitialized" } */
    return 1;
  return 0;
}