nonportable code or incorrect compilers?

Guy Harris guy at gorodish.Sun.COM
Wed Jul 13 15:20:41 AEST 1988


> >> 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.



More information about the Comp.std.c mailing list