[net.bugs.4bsd] Bug in Pascal

km@emory.UUCP (Ken Mandelberg) (02/04/84)

We have found an apparent bug in pix on 4.2 on real reads. The 
same problem does not occur on either pc or pix on 4.1. Has
anyone fixed this yet? The bug report follows.

Ken Mandelberg
Dept of Math and CS
Emory University
{akgua,sb1,gatech}!emory!km



Subject: Pi gives error on real reads
Index:	/usr/src/ucb/pascal/pi 4.2BSD

Description:
	Pix blows up on the second real number read from stdin.
	More precisely, the first real read following the read
	of a real number entered with a decimal point will fail.

Repeat-By:

Script started on Fri Feb  3 18:36:32 1984
% cat test2.p
program cnvx(input,output);
var 
        x:real;

begin
        readln(x); writeln(x);
        readln(x); writeln(x);
end.
% pix test2.p
Execution begins...
1.1
 1.10000000000000e+00
1.2

standard input: Bad data found on real read

Program error
Do you wish to enter the debugger? n

        Error in "cnvx"+2 near line 7.
Execution terminated abnormally.

3 statements executed in 0000.80 seconds cpu time.
%
script done on Fri Feb  3 18:37:43 1984

Fix:
	Unknown. Pc does not have the same bug, so it
can be used when real reads are needed.

km@emory.UUCP (Ken Mandelberg) (02/14/84)

This is a followup to a bug I reported in Pix (really Px)
in reading real numbers.

I just traced the problem to a library routine READ8.c in
/usr/lib/libpc.a . However, when I checked the source (and .o in
the archive) I found that the compiled px contained  a later version
of READ8.c than the library.

Specifically, if I rebuild px and diff the 'what' against the
distributed px I get:

1c1
< px.rebuilt
---
> px.cameoff4.2tape
20c20
< 	EXCEPT.c 1.3 1/10/83
---
> 	EXCEPT.c 1.4 10/1/83
39,40c39,40
< 	READ4.c 1.6 4/9/82
< 	READ8.c 1.5 4/9/82
---
> 	READ4.c 1.8 10/28/83
> 	READ8.c 1.7 10/28/83
42c42
< 	READE.c 1.5 6/10/81
---
> 	READE.c 1.6 10/28/83
75c75
< 	UNSYNC.c 1.3 6/10/81
---
> 	UNSYNC.c 1.4 10/28/83

As it happens the rebuilt version (with the older modules)
does not have my real read bug, so I am happy. However,
I am nervous about using modules that are as much as
two years older than what was imbedded in the px that
came on our 4.2 tape. I don't have much alternative, since
there is no source on our 4.2 tape for the newer versions.

If anyone has the source to the newer modules, or knows what
they fix I would like to hear about it.

Ken Mandelberg
Emory University
Dept of Math and CS
{akgua,sb1,gatech}!emory!km