aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/uninit-17.c
blob: 628296213d584d601f0e9fa32f13045ce78553dc (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
/* { dg-do compile } */
/* { dg-options "-O2 -Wuninitialized" } */

inline int foo(int x)
{
  return x;
}
static void bar(int a, int *ptr)
{
  do
  {
    int b; /* { dg-warning "is used uninitialized" } */
    if (b < 40) {
      ptr[0] = b;
    }
    b += 1;
    ptr++;
  }
  while (--a != 0);
}
void foobar(int a, int *ptr)
{
  bar(foo(a), ptr);
}