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