[comp.sources.d] bugs in ptc

schwartz@swatsun (Scott Schwartz) (08/05/87)

Here's the latest bug report on the pascal to C translator (ptc) that was
just posted to comp.sources.unix.

Consider the following program:

	program test(input, output);
	var
	  ch: char;

	begin
	  read(ch);
	  writeln(ord(ch));
	end.

Run it through ptc, compile it, and try it out.  You'll be surprised.

After translation, any input returns \0 -- Clearly incorrect.
The problem is that the lookahead buffer [ (*f).buf in the code ]
is never initialized when reading from standard input or writing to
standard output.  I'm still thinking about what the cleanest way to
fix this is, considering that there are probably additional similar 
bugs hiding in there somewhere.  Any comments gang?

-- 
# Scott Schwartz 
# ...{{seismo,ihnp4}!bpa,cbmvax!vu-vlsi,sun!liberty}!swatsun!schwartz