summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr48809.c
blob: 80de5bc8a3e36a01ce7cca3c9c76df6750ca7bbf (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
50
51
52
53
54
55
56
57
58
59
60
/* PR tree-optimization/48809 */

extern void abort (void);

int
foo (signed char x)
{
  int y = 0;
  switch (x)
    {
    case 0: y = 1; break;
    case 1: y = 7; break;
    case 2: y = 2; break;
    case 3: y = 19; break;
    case 4: y = 5; break;
    case 5: y = 17; break;
    case 6: y = 31; break;
    case 7: y = 8; break;
    case 8: y = 28; break;
    case 9: y = 16; break;
    case 10: y = 31; break;
    case 11: y = 12; break;
    case 12: y = 15; break;
    case 13: y = 111; break;
    case 14: y = 17; break;
    case 15: y = 10; break;
    case 16: y = 31; break;
    case 17: y = 7; break;
    case 18: y = 2; break;
    case 19: y = 19; break;
    case 20: y = 5; break;
    case 21: y = 107; break;
    case 22: y = 31; break;
    case 23: y = 8; break;
    case 24: y = 28; break;
    case 25: y = 106; break;
    case 26: y = 31; break;
    case 27: y = 102; break;
    case 28: y = 105; break;
    case 29: y = 111; break;
    case 30: y = 17; break;
    case 31: y = 10; break;
    case 32: y = 31; break;
    case 98: y = 18; break;
    case -62: y = 19; break;
    }
  return y;
}

int
main ()
{
  if (foo (98) != 18 || foo (97) != 0 || foo (99) != 0)
    abort ();
  if (foo (-62) != 19 || foo (-63) != 0 || foo (-61) != 0)
    abort ();
  if (foo (28) != 105 || foo (27) != 102 || foo (29) != 111)
    abort ();
  return 0;
}