]>
Commit | Line | Data |
---|---|---|
dfeab068 RE |
1 | #include <stdio.h> |
2 | ||
c695ebe2 MC |
3 | /*- |
4 | * This is a cc optimiser bug for ultrix 4.3, mips CPU. | |
dfeab068 RE |
5 | * What happens is that the compiler, due to the (a)&7, |
6 | * does | |
7 | * i=a&7; | |
8 | * i--; | |
9 | * i*=4; | |
10 | * Then uses i as the offset into a jump table. | |
11 | * The problem is that a value of 0 generates an offset of | |
12 | * 0xfffffffc. | |
13 | */ | |
14 | ||
15 | main() | |
16 | { | |
17 | f(5); | |
18 | f(0); | |
19 | } | |
20 | ||
21 | int f(a) | |
22 | int a; | |
23 | { | |
24 | switch(a&7) | |
25 | { | |
26 | case 7: | |
27 | printf("7\n"); | |
28 | case 6: | |
29 | printf("6\n"); | |
30 | case 5: | |
31 | printf("5\n"); | |
32 | case 4: | |
33 | printf("4\n"); | |
34 | case 3: | |
35 | printf("3\n"); | |
36 | case 2: | |
37 | printf("2\n"); | |
38 | case 1: | |
39 | printf("1\n"); | |
40 | #ifdef FIX_BUG | |
41 | case 0: | |
42 | ; | |
43 | #endif | |
44 | } | |
45 | } | |
46 |