BUG in 4.2BSD C compiler

Oliver A. McBryan mcbryan at cmcl2.UUCP
Sun Jun 3 11:44:30 AEST 1984


/*
*			BUG in 4.2 BSD C Compiler:
*
*	The following program succeeds on the first test, fails on 
*	the second which should be identical.
*
*	Both tests succeed if either
*		(a) every float is changed to double
*	or
*		(b) p.x is assigned to instead of p.y
*
*/

#include <stdio.h>

struct POINT {
	float	x;
	float	y;
};

main()
{
	struct POINT p, *q;
	float	f;

	p.y = 0.1;
	f = 1.0;

	if (p.y < (f-.01))  printf("p: %g is < %g\n",p.y,f-.01);

	q = &p;
	if (q->y < (f-.01))  printf("q: %g is < %g\n",q->y,f-.01);
}



More information about the Comp.bugs.4bsd.ucb-fixes mailing list