Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site petsd.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxj!houxm!vax135!petsd!joe
From: joe@petsd.UUCP (Joe Orost)
Newsgroups: net.sources.bugs
Subject: Re: Bug in compress - (nf)
Message-ID: <408@petsd.UUCP>
Date: Mon, 14-Jan-85 08:52:33 EST
Article-I.D.: petsd.408
Posted: Mon Jan 14 08:52:33 1985
Date-Received: Tue, 15-Jan-85 01:23:48 EST
References: <53800002@ccvaxa.UUCP>
Reply-To: joe@petsd.UUCP (Joseph M. Orost)
Organization: Perkin-Elmer DSG, Tinton Falls, N.J.
Lines: 46
Summary: Unsigned compare bug

In article <53800002@ccvaxa.UUCP> willcox@ccvaxa.UUCP writes:
>I did run into one bug that shows up when you try to run compress on a
>machine that correctly implements comparison between signed and
>unsigned ints.  The following code appears in two places in
>compress.c:
>
>    while ( (c = getchar()) != (unsigned) EOF ) {
>
>The problem is that ((unsigned) -1) is not the same thing as ((int) -1).
>The vax (and many other machines) do 32-bit compares, and say they are
>equal, but other machines (correctly) do not.  The program drops into
>an infinite loop looking for EOF.
>
>The "(unsigned)" in the above expression should be removed.  It won't
>break the program on machines that do the compare wrong, and will make
>it work on machines that do it right.
>
>With this change, compress works on the Gould machines.

You are absolutely correct.  The above code was inserted for the
Perkin-Elmer machine which outputs a 4 times slower compare instruction
without the "(unsigned)".  The correct fix follows:

Index: compress.c
710a711
> #ifdef interdata
711a713,715
> #else !interdata
>     while ( (c = getchar()) != EOF ) {
> #endif interdata
741a746
> #ifdef interdata
742a748,750
> #else !interdata
>     while ( (c = getchar()) != EOF ) {
> #endif interdata

					regards,
					joe

--
Full-Name:  Joseph M. Orost
UUCP:       ..!{decvax,ucbvax,ihnp4}!vax135!petsd!joe
US Mail:    MS 313; Perkin-Elmer; 106 Apple St; Tinton Falls, NJ 07724
Phone:      (201) 870-5844
Location:   40 19'49" N / 74 04'37" W