aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/zlib-6a.c
blob: 8c83de4863bc71bc09dd7a3fabe82cc001977aad (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* { dg-additional-options "-fno-analyzer-suppress-followups" } */

typedef unsigned char Byte;
typedef unsigned int uInt;
typedef unsigned long uLong;

typedef struct z_stream_s {
  Byte *next_in;
  uInt avail_in;
  uLong total_in;
} z_stream;

typedef struct inflate_blocks_state {
  uInt bitk;
  uLong bitb;
  Byte *write;
} inflate_blocks_statef;

extern int inflate_flush(inflate_blocks_statef *, z_stream *, int);

int inflate_blocks(inflate_blocks_statef *s, z_stream *z, int r) {
  uInt t;
  uLong b;
  uInt k;
  Byte *p;
  uInt n;
  Byte *q;
  uInt m;

  while (k < (3)) { /* { dg-warning "use of uninitialized value 'k'" } */
    {
      if (n) /* { dg-warning "use of uninitialized value 'n'" } */
        r = 0;
      else {
        {
	  s->bitb = b; /* { dg-warning "use of uninitialized value 'b'" } */
	  s->bitk = k; /* { dg-warning "use of uninitialized value 'k'" } */
	  z->avail_in = n; /* { dg-warning "use of uninitialized value 'n'" } */
	  z->total_in += p - z->next_in; /* { dg-warning "use of uninitialized value 'p'" } */
	  z->next_in = p; /* { dg-warning "use of uninitialized value 'p'" } */
          s->write = q; /* { dg-warning "use of uninitialized value 'q'" } */
        }
        return inflate_flush(s, z, r);
      }
    };
    b |= ((uLong)(n--, *p++)) << k; /* { dg-warning "use of uninitialized value" } */
    k += 8; /* { dg-warning "use of uninitialized value 'k'" } */
  }
}