summaryrefslogtreecommitdiffstats
path: root/openssl/bugs/ultrixcc.c
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-05-02 16:41:35 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-05-02 16:41:35 (GMT)
commit3d328008deedc58cd7a11c79063cefa7d662d4fc (patch)
treecb41a048885ce7b493f406360cf5f6edf689c468 /openssl/bugs/ultrixcc.c
parent0a2b8b8e0bc2e91a9f10659b30e2e4f5b79ce692 (diff)
downloadblt-3d328008deedc58cd7a11c79063cefa7d662d4fc.zip
blt-3d328008deedc58cd7a11c79063cefa7d662d4fc.tar.gz
blt-3d328008deedc58cd7a11c79063cefa7d662d4fc.tar.bz2
inital commit
Diffstat (limited to 'openssl/bugs/ultrixcc.c')
-rw-r--r--openssl/bugs/ultrixcc.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/openssl/bugs/ultrixcc.c b/openssl/bugs/ultrixcc.c
new file mode 100644
index 0000000..6e24549
--- /dev/null
+++ b/openssl/bugs/ultrixcc.c
@@ -0,0 +1,44 @@
+#include <stdio.h>
+
+/*-
+ * This is a cc optimiser bug for ultrix 4.3, mips CPU.
+ * What happens is that the compiler, due to the (a)&7,
+ * does
+ * i=a&7;
+ * i--;
+ * i*=4;
+ * Then uses i as the offset into a jump table.
+ * The problem is that a value of 0 generates an offset of
+ * 0xfffffffc.
+ */
+
+main()
+{
+ f(5);
+ f(0);
+}
+
+int f(a)
+int a;
+{
+ switch (a & 7) {
+ case 7:
+ printf("7\n");
+ case 6:
+ printf("6\n");
+ case 5:
+ printf("5\n");
+ case 4:
+ printf("4\n");
+ case 3:
+ printf("3\n");
+ case 2:
+ printf("2\n");
+ case 1:
+ printf("1\n");
+#ifdef FIX_BUG
+ case 0:
+ ;
+#endif
+ }
+}