DERMOTT@DREA-XX.ARPA (Dave Dermott) (05/28/87)
DECUS C PROBLEMS ON VMS This may not be the right group for DECUS C but I don't know where else to ask and there were several messages about it here. 1/ DECUS-C on VMS RSX emulation mode ? I can't run the DECUS C compiler on VMS RSX11 emulation mode. The compiler starts but aborts with "Memory protect error". The same task does work when I move it to a real PDP 11. I used the supplied command file(VMAKCC.COM) for building it on VMS but I used object files that had been assembled previously on a real PDP11. Do I have to reassemble all the sources on VMS ? I rebuilt the task on VMS from objects. 2/ BUG in DECUS C I found this bug in the compiler . It generates a word "add" when it should be a byte "add". This causes an address error when an odd address is reached, the sum will also be wrong. .11: mov $_data,r4 * r4 contains address of data[0] add _i,r4 * add i to address movb _chksum,r0 add (r4),r0 * add word causes error odd address movb r0,_chksum This code occurs in SPACK in the original C-KERMIT. Changing chksum to int works. Has this bug been fixed? /* -------------------------------------------------- */ /* odd addressing error in DECUS C for pdp 11 */ #include <stdio.h> char data[10]; char chksum; /* int chksum works */ int i; int len; int t; main() { len=5; chksum=0; for (i=0;i<len;i++){data[i]=i+1;} /* initialize array */ for (i=0;i<len;i++){ chksum += data[i]; /* sum array causes error */ } t=chksum; printf(" sum is %d\n",t); } /* ------------------------------------------------------ */ / Decus C patch level 9, Compilation date: "Thu May 28 15:09:06 1987" .psect c~data _data: .blkb 12 .even _chksum: .blkb 1 .even _i: .blkb 2 .even _len: .blkb 2 .even _t: .blkb 2 .even .psect c~code _main: jsr r5,csv~ mov $5,_len clrb _chksum clr _i br .4 .5: mov _i,r4 inc r4 mov $_data,r0 add _i,r0 movb r4,(r0) .3: inc _i .4: cmp _i,_len blt .5 .2: clr _i br .10 .11: mov $_data,r4 add _i,r4 movb _chksum,r0 add (r4),r0 * add word causes error odd address movb r0,_chksum .7: inc _i .10: cmp _i,_len blt .11 .6: movb _chksum,r0 mov r0,_t .psect c~strn .12: .byte 40,163,165,155,40,151,163,40,45,144,12,0 .psect c~code mov _t,-(sp) mov $.12,-(sp) jsr pc,_printf cmp (sp)+,(sp)+ .1: jmp cret~ .psect c~data .even .globl _chksum .globl _printf .globl _data .globl _main .globl _len .globl _i .globl _t .globl csv~ .globl cret~ .psect c~code .even .psect c~data .even -------