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