Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!oliveb!sun!gorodish!guy
From: guy@gorodish.Sun.COM (Guy Harris)
Newsgroups: comp.std.c
Subject: Re: nonportable code or incorrect compilers?
Message-ID: <59649@sun.uucp>
Date: 13 Jul 88 05:20:41 GMT
References: <133@daitc.ARPA> <430@uwovax.uwo.ca> <2973@geac.UUCP>
Sender: news@sun.uucp
Lines: 37

> >> But your mileage may vary.  4.2BSD VAX, Gould, and Sun-3 produce output:
>                                ^^^^^^^^^^
> >> 	count is 800, now 800
> 
> I don't get this at all! I am running on a VAX 8650 under Ultrix 2.0.

So?  He said "4.2BSD", not "Ultrix 2.0".  4.2BSD and Ultrix 2.0 are different
systems; there's certainly no guarantee that any particular bugs in the 4.2BSD
compiler are also in the Ultrix 2.0 compiler.  One would hope, in fact, that
this would *not* be the case....

I see no reason not to take him at his word here; I presume that he, at least,
is actually *running* 4.2BSD.

> HOWEVER, my sun 3/50 under Sun O/S 3.2 gives the following:
> 
> cc non-optimized	count is 800, now 800
> cc optimized		count is 800, now 800

I believe this is an old PCC bug; the 4.2BSD VAX and Sun compilers are
PCC-based, and the Gould one may be PCC-based as well.  I would not be
surprised if the Pyramid compiler were *not* PCC-based.

My Sun-4/260, and a Sun-3/180 nearby, both running SunOS 4.0, as well as a
not-so-nearby Sun386i running SunOS 4.0RRBETA2, all give

	cc non-optimized	count is 800, now 840
	cc optimized		count is 800, now 840

A 4.3BSD VAX gives

	cc non-optimized	count is 800, now 839
	cc optimized		count is 800, now 839

Presumably the DEC compiler (if it's not the VAX C compiler, in which case you
should get the same results as on VAX/VMS) has had this bug fixed, as have the
4.3BSD compiler and the SunOS compilers.