aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr109031-1.c
blob: 9e85f108f79752dcc762cc1d5262f303e69fd30a (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
/* { dg-do run } */
/* { dg-options "-O2" } */
unsigned char uc;
__UINT16_TYPE__ us;

void testuc() {
  unsigned int g = 0;
  unsigned int *p1 = &g;
  unsigned char *p2 = &uc;

  do {
    (*p1)++;
    (*p2)--;
  } while (uc);

  if (g != 256)
    __builtin_abort();
}

void testus() {
  __UINT32_TYPE__ g = 0;
  __UINT32_TYPE__ *p1 = &g;
  __UINT16_TYPE__ *p2 = &us;

  do {
    (*p1)++;
    (*p2)--;
  } while (us);

  if (g != 65536)
    __builtin_abort();
}

int main() {
  testuc();
  testus();
  return 0;
}