Yet another pcc botch

Lawrence V. Cipriani lvc at cbnews.ATT.COM
Fri Jan 20 23:32:29 AEST 1989


This program demonstrates a bug that is in some versions of pcc:

main()
{
	float f, g;
	unsigned short u, v;
	short s, t;

	u = 250;
	s = 250;

	t = 100;
	v = 100;

	f = t - s;
	g = v - u;

	printf("f = %f, g = %f\n", f, g);
}

When compiled and executed the output is:

f = -150.000000, g = 65386.000000

The correct value for g is -150.000000.  This bug is *not* present
in the cc that comes with SVR3 from AT&T.  It is present in SVR2 for
VAX and 3B20.
-- 

Larry Cipriani, AT&T Network Systems, Columbus OH,
Path: att!cbnews!lvc    Domain: lvc at cbnews.ATT.COM



More information about the Comp.lang.c mailing list