Subject: unsigned long cast of constant causes compiler error (#237) Index: lib/ccom/optable 2.11BSD Description: The following program causes the C compiler to give the error: 9: No code table for op: %(123) type: 9 note that the first printf line compiles successfully. ------------foo.c------- #include main() { unsigned long base = 0xff; unsigned long ulong_max = ULONG_MAX; printf("%ld\n", ulong_max % base); printf("%ld\n", (unsigned long)ULONG_MAX % base); } ------------- Repeat-By: cc foo.c Fix: The problem only affected the case of casting a constant. Other cases, such as when the operand was another unsigned long worked fine. There was a(nother) missing entry in the code generation tables. Apply the following patch to 'optable', remake and install the C compiler. Cut where indicated, saving the file to /tmp/p237 and then: 1) patch -p0 < /tmp/p237 2) cd /usr/src/lib/ccom 3) make 4) make install 5) make clean 6) rm /tmp/p237 Previous patches and updates are available via anonymous ftp to FTP.IIPO.GTEGSC.COM in the directory /pub/2.11BSD. ====================cut here=============== *** /usr/src/lib/ccom/optable.old Sun Nov 20 21:27:08 1994 --- /usr/src/lib/ccom/optable Tue Apr 25 16:29:42 1995 *************** *** 1163,1168 **** --- 1163,1169 ---- /* *, /, rem for unsigned long */ cr121: %nul,nl + %nl,nul %nul,nul % [l82] *** /VERSION.old Mon Apr 10 18:23:52 1995 --- /VERSION Tue Apr 25 19:36:58 1995 *************** *** 1,4 **** ! Current Patch Level: 236 2.11 BSD ============ --- 1,4 ---- ! Current Patch Level: 237 2.11 BSD ============