summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/20080719-1.c
blob: 694abcbf9851bbc563578a30c4ea4972ba5a58c8 (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
61
62
63
64
65
typedef unsigned int u32;

static const u32 deadfish = 0xdeadf155;

static const u32 cfb_tab8_be[] = {
    0x00000000,0x000000ff,0x0000ff00,0x0000ffff,
    0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff,
    0xff000000,0xff0000ff,0xff00ff00,0xff00ffff,
    0xffff0000,0xffff00ff,0xffffff00,0xffffffff
};

static const u32 cfb_tab8_le[] = {
    0x00000000,0xff000000,0x00ff0000,0xffff0000,
    0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00,
    0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff,
    0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff
};

static const u32 cfb_tab16_be[] = {
    0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
};

static const u32 cfb_tab16_le[] = {
    0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff
};

static const u32 cfb_tab32[] = {
 0x00000000, 0xffffffff
};






const u32 *xxx(int bpp)
{
 const u32 *tab;

if (0) return &deadfish;

 switch (bpp) {
 case 8:
  tab = cfb_tab8_be;
  break;
 case 16:
  tab = cfb_tab16_be;
  break;
 case 32:
 default:
  tab = cfb_tab32;
  break;
 }

 return tab;
}

int main(void)
{
  const u32 *a = xxx(8);
  int b = a[0];
  if (b != cfb_tab8_be[0])
    __builtin_abort ();
  return 0;
}