larryh@tekgvs.TEK.COM (Larry Hutchinson) (12/02/87)
I have discovered yet another MPW C 2.0 bug. It seems that the memory manager glue proc 'PurgeSpace(total,contig)' uses the wrong trap word. The trap that is called is _HSetState (with garbage as parameters) rather than _PurgeSpace. I have included at the end of this note an MPW assembler proc to replace the faulty one. Actually, I have included two: my own code and an exact replica of the original code (which is apparently machine generated). I believe the code is correct, but you need to check it out yourself. But first, a few whining, sniveling comments: Why am I the only one to post MPW C bug reports to the net? Am I the only one that finds them? -- Hardly likely (in spite of the popularity of LightSpeed C). Does everyone else already knows about them from GENIE or some other BBS or via MCI mail to developer support? Do other people just not bother? Come on, Jordan, surely a bug list exists for the MPW product line: why not save a few thousand hours of programmer time and publish it to the net? Larry Hutchinson, Tektronix, Inc. PO Box 500, MS 50-383, Beaverton, OR 97077 { decvax,allegra }!tektronix!tekgvs!larryh ; ; PurgeSpace.a ; replaces the faulty version from MPW C 2.0 ; INCLUDE 'Traps.a' CASE ON ; we're talking to c ;===================================================================== ; ; PROCEDURE PurgeSpace(VAR total,contig: LONGINT); ;===================================================================== PurgeSpace PROC EXPORT _PurgeSpace move.l 4(sp),a1 ; addr of total move.l d0,(a1)+ ; stow total move.l a0,(a1) ; and contig rts ENDP END NOTE: the above is my version of PurgeSpace. The following is an exact replacement for the original code -- it just uses the correct trap. move.l d2,-(sp) ; save d2 _PurgeSpace move.l a0,d2 ; value of contig move.l 8(sp),a0 ; addr of total move.l d0,(a0) move.l 12(sp),a0 ; addr of contig move.l d2,(a0) move.l (sp)+,d2 ; restore d2