aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/pr94858-2.c
blob: 874fe8b2c75f82db576ffa1e3d7e9726826500b1 (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
#include <stdlib.h>

typedef short hashNx;

typedef struct hashSt {
  hashNx *hs_index;
  int hs_used;
  int hs_slots;
} hashSt;

int test (hashSt *td, int slots)
{
  hashNx *index;

  index = malloc((size_t)slots * sizeof(hashNx));
  if (index == NULL)
    return 0;
  td->hs_index = index;
  td->hs_slots = slots;

  for (slots = td->hs_slots, index = td->hs_index; --slots >= 0;)
    *index++ = -1;

  return 1;
}