Bugs in profiling and C compile on PDP-11

utzoo!decvax!harpo!npoiv!npois!houxm!houxa!houxi!houxz!hocda!spanky!ka utzoo!decvax!harpo!npoiv!npois!houxm!houxa!houxi!houxz!hocda!spanky!ka
Mon Mar 7 23:03:18 AEST 1983


Profiling doesn't work for programs with text sizes greater than 32K bytes
on the PDP-11.  There are two reasons for this.  First, rather than testing
for lowpc greater than highpc, the monitor routine subtracts the two and
tests the difference.  Since no error message is printed, the test doesn't
do much good anyway, so I just deleted it.  The second problem is a bug
in the code generator for the C compiler.  In the assignment to text, it
compiles the shift operator into a signed shift rather than an unsigned
shift.  I haven't found the bug in the C compiler, but it can be sidestepped
by breaking the assignment up into two statements.  A diff of the two ver-
sions of the monitor routine is given below.
					Kenneth Almquist

$ diff /usr/src/lib/libc/pdp11/gen/mon.c mon.c
54,57c54,55
< 	if(bufsiz <= 0 || lowpc-highpc >= 0)
< 		return;
< 
< 	text = (unsigned)(highpc+1-lowpc)>>1;	/* No. WORD's of text*/
---
> 	text = (unsigned)(highpc+1-lowpc);	/* No. WORD's of text*/
> 	text >>= 1;
$ 



More information about the Net.bugs.usg mailing list